-4

I have an Json Array Like -

[
  500,
  "Applied Before"
]

How can I parse it in android.

Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
Mahmudur Rahman
  • 638
  • 9
  • 25

2 Answers2

1

You can try like this

 String data = " [500," +
            "  \"Applied Before\"] ";
    try {
        JSONArray arr = new JSONArray(data);
        Log.i("arr",""+arr.get(0));
    } catch (JSONException e) {
        e.printStackTrace();
    }
SaravInfern
  • 3,338
  • 1
  • 20
  • 44
0

Improper JSON Array syntax .

Example of a JSON Array :

"employees":[
        {"firstName":"John", "lastName":"Doe"}, 
        {"firstName":"Anna", "lastName":"Smith"}, 
        {"firstName":"Peter","lastName":"Jones"}
    ]
Mahmudur Rahman
  • 638
  • 9
  • 25
prashant0205
  • 269
  • 1
  • 3
  • 17
  • Try- http://jsonlint.com/ --link for check your json data is validate or not. – Mahmudur Rahman Jun 06 '16 at 06:42
  • how about this of your code - {"employees": [{ "firstName": "John", "lastName": "Doe" }, { "firstName": "Anna", "lastName": "Smith" }, { "firstName": "Peter", "lastName": "Jones" }]} – Mahmudur Rahman Jun 06 '16 at 06:51