Skip to content
Advertisement

Tag: json

Get object from .readEntity

I have a java service which calls an API and gets the following in return How can i use .readEntity (or something else) to get the object for a given field; say service2 Or just convert all objects inside status to a List<> of objects String output = response.readEntity(String.class); works, but i dont know how to parse it properly to

Java show/hide object fields depending on REST call

Is it possible to config the Item class that depending on the REST call to show and hide specific fields? For example I want to hide colorId (and show categoryId) from User class when calling XmlController and vice versa when calling JsonController. Item class JSON Controller XML Controller Answer I’ve solved it by creating following View: With this config it

Error parsing JSON (MismatchedInputException)

I’m having problems parsing JSON, this is the error: And I know why it is happening I just don’t know how to fix it. This JSON works: This one does not: The problem seems to be the { character in front of the info field because with [ works. So this is the method I’m using to parse the JSON:

Advertisement