A
A
Anatoliy Mikhailov2016-11-09 04:32:26
Java
Anatoliy Mikhailov, 2016-11-09 04:32:26

How can you easily deserialize json into ready-made model classes in Java (just like newtonsoft for c#)?

How can I easily deserialize json into ready-made model classes in Java? I myself mostly write in c#, now I needed to write a small project on android, I ran into the problem of easy parsing of json data. On the Internet, they suggest making a constructor for each class, and in it, for each field, set the values ​​\u200b\u200bderived from JSONObject'a, which is quite dreary. Maybe somehow I was looking in the wrong way, but for example in c# (using newtonsoft ) I can do just

string jsonString = "{...json строка...}";
DataResult result = JsonConvert.DeserializeObject<DataResult>(jsonString);

I hope for your help!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question