1
Hello,
I don’t have so much knowledge in Json and I’m having a problem and I couldn’t find an exact solution to it in the community.
I have the following json file format:
{
"name" : "ProductName",
"description" : "description",
"alternate": [
{"type": "prodType", "element": "prodElement"}
]
},
What I need and can’t get:
Take the 'prodType' value inside the 'Alternate' and store it in a string and do the same with the 'prodElement' value'.
My Gson file looks like this:
@SerializedName("name")
public String name;
@SerializedName("description")
public String description;
@SerializedName("alternate")
public List alternate;
I didn’t declare 'Type' and 'Element' because I don’t know if I should and how I would.
I made the getters and the setters, but it only returns the whole line:
{"type": "prodType", "element": "prodElement"}
Does anyone know how to proceed?
Grateful!
Perfect! That’s what I was doing wrong. I had already seen some examples somewhat similar but had not understood very well, thank you, you broke a branch!
– Luís Gustavo Vieira