I want to use java to make read return value from a url. The response json may be
{
token:"blablablabla",
expired: 7200
}
or of the form:
{
errcode: 201
errmsg: "out of limited"
}
I currently used jackson
to convert json to java object. Yet in my condition, the response json may be different. All the example and tutorial I had found deal with a json string of only one form.
I would like to know what is the best practice when dealing with this situation.Currently I just catch (JsonMappingException e)
and try again to convert to a different class.