java - Link array of JsonNodes to ArrayNode -


i have arraynode looks this:

[{     "a": "a",     "b": "b",     "c": "c" }] 

i'd manually add array of jsonnodes :

[{     "a": "a",     "b": "b",     "c": "c",     "d": [{             "d": "d",             "e": "e"          }] }] 

i thinking doing this:

final objectnode jsonnode = nodefactory.objectnode(); jsonnode.set(name) // name == "d", method prototype set(string, jsonnode) arraynode.add(jsonnode); 

problem set method must take jsonnode second parameter. want create "d" key in order link other jsonnodes thereafter. missing?

you need create member nodes before push value objectnode. keeping keys/values in map behind scenes.

objectnode node = nodefactory.objectnode(); node.set("d", buildarraynode()); ...  private arraynode buildarraynode() {     // build node here     arraynode arraynode = nodefactory.arraynode();     arraynode.add(...); } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -