0

[{ 'langkey':'Arabic','value':'المملكة العربية السعودية'} ,{ 'langkey':'English','value':'Saudi Arabia'} ]

Suresh Thoutam
  • 258
  • 1
  • 7
  • Does this answer your question? [How do I deserialize a JSON string into an NSDictionary? (For iOS 5+)](https://stackoverflow.com/questions/8606444/how-do-i-deserialize-a-json-string-into-an-nsdictionary-for-ios-5) – Sergio Aug 14 '20 at 09:52
  • thats not works for me. I am getting string from server like below. [{ 'langkey':'Arabic','value':'المملكة العربية السعودية'} ,{ 'langkey':'English','value':'Saudi Arabia'} ] – Suresh Thoutam Aug 14 '20 at 09:56
  • Consider that the string is not valid JSON – vadian Aug 14 '20 at 09:56
  • Can you plz tell me how i can split ? – Suresh Thoutam Aug 14 '20 at 09:58
  • Replace the single quotes with double quotes and deserialize the string as described the linked question. – vadian Aug 14 '20 at 10:02

1 Answers1

1

Yo need to create a valid JSON first:

NSString *validJsonString = [@"[{ 'langkey':'Arabic','value':'المملكة العربية السعودية'} ,{ 'langkey':'English','value':'Saudi Arabia'} ]" stringByReplacingOccurrencesOfString:@"'" withString:@"\""];

Then, do this:

How do I deserialize a JSON string into an NSDictionary? (For iOS 5+)

Sergio
  • 1,610
  • 14
  • 28