How can I parse json using gson? I have a json array with multiple object types, and I don't know, what kind of object I need to create to save this structure. I cannot change the json data format (I don't control the server). Can I use gson or other library parse this json array, how should I do?
This is the json code block:
[
{
"type": 1,
"object": {
"title1": "title1",
"title2": "title2"
}
},
{
"type": 2,
"object": [
"string",
"string",
"string"
]
},
{
"type": 3,
"object": [
{
"url": "url",
"text": "text",
"width": 600,
"height": 600
},
{
"url": "url",
"text": "text",
"width": 600,
"height": 600
}
]
},
{
"type": 4,
"object": {
"id": 337203,
"type": 1,
"city": "1"
}
}
]