Search code examples
iosjsonnsstringnsarraynsdictionary

How to add static JSON in iOS ? (Convert string to JSON)


How can I convert general JSON string into Objective-C formatted JSON.

Here is the example:

{
  "data": {
    "resultGenerationTimestamp": 1460803271,
    "deleted": [],
    }
}

I am getting this response from Postman. I need to make it JSON and add into iOS Coredata. How would I make it JSON compatible with iOS ?

I know how to convert NSString to JSON object that will have Arrays of Dictionaries, but I don't know how would I put above given string as a NSString.


Solution

  • Your json is in the format of [Dictionary[Dictionary]]. So do the coding to make it in that format.