I am using JSON with the Gson package for java. I have an object in which there are some internal links from an object in one field to an object in another field. For instance:
{"loci": [{"id": "loc1",
"length": 10000, "start": 2},
{"id": "loc2", "length": 100,
"start": 50000}] , "scripts": [{"" id ":" scen1 "," loci ": [{" id ":" loc1 "," length ": 10000," start ": 2}, {" id ":" loc2 " , "length": 100, "start": 50000}]},]}
So, I actually only have two locus objects defined in my java program (loc1 and loc2), but in the printout the objects are duplicated and displayed both under "loci" and inside "scen1". Can JSON reflect that in fact there are only two objects (therefore, when I load it, it will not create four locuses instead of two)?
source
share