0

I am getting JSON response from some web server, say the server returns:

"kən.grætju'leiʃən"

I use AFNetworking and JSONKit, but what I've received is:

"æm'biʃən"

Not sure if it's AFNetworking's problem or JSONKit's problem, but any way, how to I parse and convert the string so it looks the same as from server?

Thanks

Heuristic
  • 5,087
  • 9
  • 54
  • 94

1 Answers1

2

The server may be returning characters encoded in a way that violates the official JSON spec. If those characters are encoded as escaped unicode IDs (like \U1234) then JSONKit and NSJSONSerialization should both handle them fine.

If you can't change the server, you can work around the issue by URL-decoding the string - see https://stackoverflow.com/a/10691541/1445366 for some code to handle it. But if your server isn't following the correct specs, you're likely to run into other issues.

Community
  • 1
  • 1
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287