Answer the question
In order to leave comments, you need to log in
Good tools for working with json in Java?
In general, I have a similar json
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"parser": 1,
"date_of_check": "2017-03-24",
"city": 2,
"parse_city": "hfghfgh"
},
{
"parser": 1,
"date_of_check": "2017-03-24",
"city": 4,
"parse_city": "Donezk"
}
]
}
Answer the question
In order to leave comments, you need to log in
https://github.com/google/gson
https://futurestud.io/tutorials/gson-getting-start...
Oddly enough, I would recommend the Mongo driver. It doesn't matter if it's a driver. Data can be put into it without loading data from the Mongo server.
mvnrepository.com/artifact/org.mongodb/mongo-java-... (There is a newer version)
Declare a variable for your array:
import com.mongodb.*;
import com.mongodb.util.JSON;
BasicDBObject json = (BasicDBObject) com.mongodb.util.JSON.parse(json_str);
BasicDBList result = (BasicDBList)json.get("result");
For Android - standard org.json.*
for everything else - don't use Java.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question