I want to create a Json object like the following:
{"name": "Maximum", "children": [
{"name": "where", "size": 299},
{"name": "xor", "size": 354},
{"name": "_", "size": 264}
]
}
Which library to use to create the above Json string and how should the code look like?
Try gson . It has good support for this. Check out this user guide.
Your class structure would look like:
then in your code: