Questions tagged as 'gson'

1
answer

How to manipulate a Json object before returning to the API

Hello I'm using this method in my controller: @GetMapping(value="/{id}/perfil", produces = MediaType.APPLICATION_JSON_VALUE) public String carregarPerfilUsuario(@PathVariable("id") Long id, HttpServletResponse response) throws IOException {...
asked by 15.10.2018 / 03:49
0
answers

Read json with gson

I would like to read the JSON below with GSON, put each row in a POJO and add in a ArrayList . But I can not read JSON. {"user_id":"K4cXASVRZHM6l_t0l_kBzQ","name":"Rob","review_count":238,"friends":"7VQ46TLFWcJ9NC-Sf9r0cQ, GEbyCpz3QmMh23...
asked by 10.09.2018 / 21:29
1
answer

Sort objects in json file (Java)

I have the following JSON file: {"idAluno":1,"nomeAluno":"Teste","listaDeTurmas":[1,2,3,4]} {"idAluno":4,"nomeAluno":"Teste","listaDeTurmas":[1,2,3,4]} {"idAluno":3,"nomeAluno":"Teste","listaDeTurmas":[1,2,3,4]} {"idAluno":5,"nomeAluno":"Teste...
asked by 09.04.2018 / 18:27
1
answer

Get specific value from a JSON URL in JAVA

Good morning Friends. I'm having a hard time dealing with information collected in a third-party JSON url online, my JPA needs information from multiple sites that return in different ways in the JSON queries, below I'll outline the ways they...
asked by 12.03.2018 / 14:59
1
answer

Accessing a JSON key

I'm doing a POST request to my Webservice and I'm getting a Json as a result, I'd like to get a specific field from Json because the key names are fixed eg: "field1, field2, field3" ... and so on against. I'm trying to use GSON but I'm unsuccess...
asked by 02.03.2018 / 16:21
1
answer

Problems with Google Gson: Unparseable date: "Apr 19, 1991"

Work with Google's Gson to persist and retrieve Java Objects. I use this code to create and format Gson, in order to prepapake it to receive certain date formats, which comes from forms and the database. Gson g = new GsonBuilder().registerType...
asked by 27.12.2017 / 19:27
1
answer

Deserialize JSON with dynamic field names

I have a Json like this, and inside the "buy" entity, I get an object with the id of the purchase, and then the information I need to access, I have already generated the classes, but my object that changes each name is getting null { "Pedi...
asked by 25.07.2017 / 13:41
1
answer

Hibernate auto relationship turning into json break

I'm using Hibernate to persist the objects in an embedded HSQLDB file. I've created a similar method from a "tester" to popular and fetch the persisted information. But when I look for the informations, in debug mode it's like my result is...
asked by 10.07.2017 / 14:25
1
answer

Using Gson instead of Jackson on web service that makes use of Jersey

I found that Jersey by default makes use of the Jackson framework for resources to return data in Json format. However, I had the need to use the Gson framework to convert the objects to Json. How to do this if Jersey uses Jackson implicitly?...
asked by 11.05.2017 / 16:06
1
answer

Gson does not work

I have a WCF service that returns a Json to be consumed on an Android App, as you can see on the link However, Gson is not serializing in the specific POJO. public class VeiculoContainer implements Serializable { private String i...
asked by 02.04.2017 / 09:49