Structuring data hierarchy in JSON -
i trying write following data structure in json. each item generic string of text. cannot head around if "arrays inside arrays" situation or "objects inside objects". how should structure it?
edit create context: data bits of text website (links, descriptions, etc.), needs translated different languages. means every json-key unique.
here dummy data:
1 1.1 1.1.1 1.1.2 1.1.3 1.2 1.3 1.4 2 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.1.10 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.3 2.3.1 2.3.2 2.3.3 3 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 4 4.1 4.2 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.2.10 5 5.1
i suggest store json tree this
[ { "text": "parent 1", "id" : "1", "nodes": [ { "text": "child 1", "id" : "2", "parentid" : "1", "nodes": [ { "text": "grandchild 1", "id" : "4", "parentid" : "2", }, { "text": "grandchild 2", "id" : "8", "parentid" : "2", } ] }, { "text": "child 2", "id" : "10", "parentid" : "1", } ] }, { "text": "parent 2", "id" : "19", //no parent id } ];
Comments
Post a Comment