Questions tagged as 'gson'

1
answer

Manipulating a JSON with the GSON library

This is json: { "professor": [ { "latitude": -23.1843473, "longitude": -45.8840718, "title": "Microcamp", "endereco": "rua vilaça 2010" }, { "latitude": -23.1843473, "longitude": -45.8840718, "title": "Microcamp", "endereco": "...
asked by 30.10.2017 / 13:09
1
answer

Gson Return Array of One Position

Hello I have the method: @RequestMapping("/olaMundo") public String iniciando(Model model, Cadastro cadastro){ CadastroDAO dao = new CadastroDAO(); dao.adiciona(cadastro); model.addAttribute("nome",cadastro.getNo...
asked by 04.04.2017 / 20:16
0
answers

Include and remove elements of a Json with the Gson (Java)

I'm using the Gson library in Java, I have the following structure in a json file: {"idAluno":4, "nomeAluno":"Teste da Silva", "listaDeTurmas":[1,2,4]} Is it possible, with this library, to change the "list ofTurmas" entry to include / remo...
asked by 07.04.2018 / 22:26
0
answers

Gson Does Not Convert List In Json

Every time I try to pull all the data from a database table and convert the result to json, using Gson, it gives error. @GET @Path("todos") public String todos() { Gson g = new Gson(); UsuarioRepository usuarioRepository = new UsuarioR...
asked by 29.03.2017 / 16:01
1
answer

How to construct a json answer using Gson

First of all, I agree that the question was a bit strange, but I can not write my question any other way. At the end of the explanation of the problem if someone wants to suggest a better title that expresses the problem better, I will be gratef...
asked by 22.09.2018 / 16:43
1
answer

Convert Java object to JSON with Gson (generating with backslash)

I'm trying to generate a JSON based on a Java object. JSON is being generated, but some slashes have been improperly included: import java.io.Serializable; import com.google.gson.annotations.SerializedName; public class Documento implemen...
asked by 30.11.2018 / 13:00
1
answer

Error converting JSON. (com.google.gson.stream.MalformedJsonException)

I'm developing a program that needs to communicate with an online store, all communication is via HTTP requests and has a JSON response. Displays the com.google.gson.stream.MalformedJsonException error. I have checked it several times...
asked by 24.11.2018 / 15:14
1
answer

How to deserialize a geometric polygon with Gson?

I'm using Vraptor 4 and the intent is to create a polygon convert class that does deserialization and which serialize. My problem is just deserializing. How to deserialize a geometric polygon with Gson? Follow the json where I need to deseria...
asked by 17.10.2014 / 15:44
2
answers

How to read the json below with the GSON library [duplicate]

How to read the json below creating the class profession with the instances of the class I would like it to be in GSON without using HashMap - KeySet() ; { "profissao": { "jornalista": [ "escritor",...
asked by 29.08.2017 / 16:20
1
answer

Values with different types Gson - Java

I'd like to know if there is a way with Gson to get values of different types in a "key-value" array in Json. Here's the example: { "events":[ {"event":"comprou-produto", "timestamp":"2016-09-22T13:57:32.2311892-03:00"...
asked by 06.10.2018 / 19:44