IPhone : Parsing Invalid JSON

on Tuesday, February 24, 2015

because hardware limitation I need to parse invalid JSON formats. With NSJSONSerialization if the JSON is invalid or if have some special characters returns nil. For example



{
"/http/header":"
{\"code\":\"200\",
\"response\":\"The request has succeeded\",
\"body\":\H4؊捵ե7Ǫ㖮OƋ\"V鈭핬Ͱ枥ù޷+=豞EA㯕頎̵4kև΃
ΆץmZ-\"뺷뀕ԍ볰孖擽o<ҲA혃褿Уҥx蒊㟩g=Ң흨׮4YhkeȤ̪⤍βQ
䷹!긗Â㍡Զ䧡|jŔ䴕uA蝓蒎▖嗷н骭--̫Tʴͽ"}
}


This is a wrong JSON format but if we correct the format of this JSON the problem persists because we have special characters. Gson on JAVA with this kind of JSON code don't have any problem, I can get the code and response value the only nil value is the body. There are someway to have the values?


0 comments:

Post a Comment