Currently I am trying to automate JSON APIs through Java code.. I have run the JSON successfully without nesting.. Now in our API, there are nested JSON, which I need to automate through POJO... How can I do it..
One API worked for me which has single parameter.
JSON for the API
{
"userId": 1
},
JAVA Class for it.
public class Post {
@JsonProperty("userId")
private String userId;
public String getUserId()
{
return userId;
}
public void setUserId(String userId)
{
this.userId = userId;
}
}
Now I have an API which has multiple nested parameters.. How to create Java class for the same?
Nested JSON
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
How can I write Java class for this?
Thanks in advance!