Java/Gson: Change serialization of an array to that of an object -


i have java program reads json files have attributes these:

"property": {         "value1": 4.35684302507939       } 

in actual program, "property" double array, , contains fixed amount of values. format of json file fixed, , have write json files conform it. there way, can serialize double array, looks in code example? easiest way think this, create class property , serialize that, i'd avoid it. json file doesn't contain value, several others. thought, maybe can create jsonobject out of array, don't know how can have serialized in right place. ex.

    "name" : "bob"     "age" : "13"     "property": {        "value1": 4.35684302507939      } 

instead of

"name" : "bob" "property": {    value1": 4.35684302507939 } "age" : "13" 

every appreciated.


Comments

Popular posts from this blog

html - How to custom Bootstrap grid height? -

javascript - pass values from mssql to views in node -

javascript - Understanding ExtJS Framework Syntax -