Quantcast
Channel: Parse JSON Array without Key in Android - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Parse JSON Array without Key in Android

$
0
0

How would I parse an array like the following in Android?

[
 5,
 10,
 15,
 20
]

As you can see, there is no key defining the array, like other example arrays have, such as this:

{
 "items": [
   5,
   10,
   15
   ]
}

For the second array, I can easily make a JSONObject and just use:

JSONArray itemArray = jsonObject.getJSONArray("items")

But, as is obvious, there is no key for the first array. So how would one go about this? Is it even possible with standard Android libraries?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>