Use import com.alibaba.fastjson.annotation.JSONField ;
bean = JSON
.
parseObject
(
JSON
.
toJSONString
(
Map
),
bean
.
class
);
bean:
@JSONField
(name =
"BEAN_NAME"
)
private String beanName;
Map:
("
BEAN_NAME",value)
According to the
@JSONField
(name =
"####"
) value matches the key of the Map and injects the value into the bean