java - Jackson merging json array -


i have following jsons:

{"loc":[{"b":3}]} 

and

{"loc":[{"a":9}]} 

how can use jackson 2.9.0 merge them into

{"loc":[{"a":9, "b":3}]} 

this have far

public class config {     @jsonmerge     public ab[] loc; }  @jsoninclude(jsoninclude.include.non_null) public class ab {     public integer a;     public integer b;      protected ab() { }     public ab(int a0, int b0) {         = a0;         b = b0;     } }  objectmapper mapper = new objectmapper();  config = mapper.readvalue(apostoquotes("{'loc':[{'b':3}]}"), config.class); config = mapper.readerforupdating(config).readvalue(apostoquotes("{'loc':[{'a':9}]}")); 

the result

{"loc":[{"b":3},{"a":9}]} 

thanks

firstly, can json convertto list , merge list, list convertto json.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -