Map To Bean

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

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326210149&siteId=291194637
map
Map
map
Map