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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -