Answer the question
In order to leave comments, you need to log in
How to convert json file (JAVA)?
Hello. json file is coming.
{
"response": {
"count": 22687,
"items": [
{
"id": 457263017,
"album_id": -7,
"owner_id": -89600892,
"user_id": 100,
"sizes": [
{
"type": "m",
"url": "https://sun1-
90.userapi.com/c850424/v850424557/xxx/BJTxSEZNPg.jpg",
"width": 97,
"height": 130
},
{
"type": "s",
"url": "https://sun1-
84.userapi.com/c850424/v850424557/xxx/TqxyEuXzs4.jpg",
"width": 56,
"height": 75
},
{
"type": "w",
"url": "https://sun1-
15.userapi.com/c850424/v850424557/ee1x5/dx4c4pOL7Q.jpg",
"width": 1620,
"height": 2160
}
],
"text": "",
"date": 1570167720,
"lat": 46.3238,
"long": 38.2321
}
}
{"response":{"count":22687,"items":[{"id":457223263017,"album_id":-7,"owner_id":-89600892,"user_id":100,"sizes": [{"type":"m","url":"https://sun1-
90.userapi.com/c850424/v850424557/xxx/BJTxSEZNPg.jpg","width": 97,"height": 130},{"type": "s".........}}
Answer the question
In order to leave comments, you need to log in
kambulovd if you have not broken json and you are not going to throw anything out of it, then it is very simple
JsonParser parser = new JsonParser();
JsonObject jsonObject = parser.parse(ваша строка)
.getAsJsonObject();
assertTrue(jsonObject.isJsonObject());
String result = jsonObject.toString();
System.err.println("Result: " + result);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question