0

I have the below posted json contents. I would like to fetch the data with volley. my question is, should i treat it as JSONObject or JSONArray? i am asking this question because as shown below in the json data below it starts with [ and ends with ]

code:

this.mJSONObjectRequest = new JsonObjectRequest(Request.Method.GET, this.BASE_URL, null, new Response.Listener<JSONObject>() {

json

[
{
    "trends": [
    {
        "name": "#ChainedToTheRhythm",
        "url": "http://twitter.com/search?q=%23ChainedToTheRhythm",
        "promoted_content": null,
        "query": "%23ChainedToTheRhythm",
        "tweet_volume": 48857
    },
    {
    },

    {
    },
    ..
    ..
    ]
}
]
Cœur
  • 37,241
  • 25
  • 195
  • 267
Amrmsmb
  • 1
  • 27
  • 104
  • 226
  • 1
    It's an array of objects. `"trends"` it's also an array of objects. Check out [this](https://www.cheatography.com/mackan90096/cheat-sheets/json/) cool cheatsheet. You can also use [this](http://json.parser.online.fr/) json parser to easily see the objects/arrays. – grrigore Aug 25 '18 at 14:24
  • When starting with `[`, it is a JSONArray. Next token is `{`, so this JSONArray contains 1 or more JSONObject. – Cœur Aug 25 '18 at 17:59

0 Answers0