I have a JSON object returned by the server like:
{
"success":true,
"value1":1,
"otherValues":{
"var1":1,
"var2":"asd",
"var3":2
}
}
How should I model the response class to accept all the values? For example
package com.phoneme.API.popIndex;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetResponse {
private String success
private String value1;
private ??? otherValues;
//GETTERS AND SETTERS of each
}
The response you are trying to decode is not valid JSON. The field names need to be quoted. For example:-
{
"success":true,
"value1":1,
"otherValues":{
"var1":1,
"var2":"asd",
"var3":2
}
}
Using this corrected version of the message, you can generate your POJO here:- http://www.jsonschema2pojo.org/
Good luck!