Dinesh Gurrapu Dinesh Gurrapu - 6 months ago 9
iOS Question

I am not able to parse the json data having two dictionaries , I am getting response like the below while i am hiiting url in the browser

{
"type": "1",
"item": "Order created successfully.",
"order_id": "7"
}
{
"multicast_id": 9215180185089775977,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [{
"message_id": "0:1465191236656122%86acb02ff9fd7ecd"
}]
}

Answer

The way you are trying to get json response seems ok. Apparently, there is an invalid response from server. What you have posted seems invalid json. The response from server should be something like

[
  {
   "type": "1",
   "item": "Order created successfully.",
   "order_id": "7"
  }, 

  {
   "multicast_id": 9215180185089775977,
   "success": 1,
   "failure": 0,
   "canonical_ids": 0,
   "results": [{
       "message_id": "0:1465191236656122%86acb02ff9fd7ecd"
   }]
  }
]

Once you get data like that, you can store it as an array of dictionaries.

Comments