java - Map Jackson XML attribute to corresponding JSON element -


i using jackson xmlmapper deserialize xml pojo. using objectmapper serialize json.

i'd set json key value using xml attribute value. appreciated. thanks.

example xml:

<response>   <label data="somevalue" /> </response> 

needs map json as:

{   "response" : {    "label" : "somevalue"    } } 

this can right now:

{   "response" : {     "label" : {       "data" : "somevalue"     }   } } 

this pojo label element:

@jsonignoreproperties(ignoreunknown=true) public class labelobject {    @jacksonxmlproperty(localname = "data", isattribute = true)   private string data;    // getter setter } 


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -