-3

I want to convert this JSON string into a java object or list. When I am trying to convert, it says **Unexpected value at line 1 column 253** but when I checked it online on jsonlint.com and jsonformatter.org, they say it is valid JSON. I am getting this JSON from the Firestore database. If anyone knows any extension or website to parse Firestore JSON to Java object. Please let me know.

"[{
    "item": {
        "title": "Vegetable Korma",
        "description": "Very mild dish with cuamt and creamy sauce ",
        "price": 5.5,
        "discount": 0,
        "userUid": "kVIjP8kHXtQOXAfOiYD3pkmpkxq2",
        "quantity": "1",
        "repeat": 1,
        "otherLangTitle": null,
        "size": [{
            "title": null,
            "price": null
        }],
        "total": 13.0
    }
}, {
    "singleoption": []
}, {
    "multipleoption": [{
        "name": "Mushrooms",
        "requiredOpt": 0,
        "price": 0.5,
        "otherLangTitle": "",
        "heading": "Extra Vegetable Toppings",
        "releated": ""
    }, {
        "name": "Chicken ",
        "requiredOpt": 0,
        "price": 1.0,
        "otherLangTitle": "",
        "heading": "Extra Meat Toppings",
        "releated": ""
    }, {
        "name": "Boiled Rice",
        "requiredOpt": 0,
        "price": 1.95,
        "otherLangTitle": "",
        "heading": "Choose Any Side",
        "releated": ""
    }, {
        "name": "Ben & Jerry's",
        "requiredOpt": 0,
        "price": 2.95,
        "otherLangTitle": "",
        "heading": "Choose Any Dessert",
        "releated": ""
    }, {
        "name": "Orange Fanta",
        "requiredOpt": 0,
        "price": 1.1,
        "otherLangTitle": "",
        "heading": "Choose Any Extra Drink",
        "releated": ""
    }]
}, {
    "total": 7.5
}, {
    "size": [{
        "title": "",
        "price": "0.0"
    }]
}]"
  • What are you using to convert this JSON to Java Object? – Tonnie Jun 01 '22 at 10:41
  • The json is valid, but that does not mean your object represents the json correctly. To get any help, you need to edit question with more information - complete stacktrace, your java class, the library you use to parse json(jackson, gson, something else). Currently your question can't be answered. – Chaosfire Jun 01 '22 at 10:43
  • I suggest you work with org.json and JSONArray, JSONObject ... – Saad Zimat Jun 01 '22 at 10:53

0 Answers0