objective c - Deserialization of JSON-Value -


i have problems deserialization of json-value.

here code:

nsdictionary *responsedict = [nsjsonserialization jsonobjectwithdata: data options:0 error: &errorjson]; nsstring *innerjson = responsedict[@"d"]; nsmutabledictionary *innerobject = [innerjson jsonvalue]; 

as can see in fallowing printscreen (which taken right after executing last line of code above), items in dictionary innerobject contains special characters, not there in innerjson. can me, why occurs?

enter image description here

edit - added descriptions of variables console

innerjson:

{"ret" : "1",  "msg" : "",  "list" : ["granatapfel¤200g¤1", "brombeeren¤300g¤1", "papaya (100 g)¤3¤0", "epf müesli 1 messlöffel¤2¤1", "grüner spargel (190 g)¤2¤1", "chicorée (130 g)¤1¤0", "mageres kalbfleisch (190 g)¤3¤0", "zander (160 g)¤6¤0", "bachsaibling (190 g)¤2¤0", "seeteufel (160 g)¤1¤0", "epf guetzli hafer/\nkartoffel-dinkel 3 stk.¤0¤0"]} 

innerobject:

{     list =     (         "granatapfel\u00a4200g\u00a41",         "brombeeren\u00a4300g\u00a41",         "papaya (100 g)\u00a43\u00a40",         "epf m\u00fcesli 1 messl\u00f6ffel\u00a42\u00a41",         "gr\u00fcner spargel (190 g)\u00a42\u00a41",         "chicor\u00e9e (130 g)\u00a41\u00a40",         "mageres kalbfleisch (190 g)\u00a43\u00a40",         "zander (160 g)\u00a46\u00a40",         "bachsaibling (190 g)\u00a42\u00a40",         "seeteufel (160 g)\u00a41\u00a40",         "epf guetzli hafer/\nkartoffel-dinkel 3 stk.\u00a40\u00a40"     ); msg = ""; ret = 1; 

}

i cannot see problem json value. description method of nsstring prints unicode characters verbatim, e.g.

"granatapfel¤200g¤1" 

on other hand, description method of nsdictionary , nsarray prints non-ascii characters \unnnn escape, e.g. \u00a4 instead of ¤:

"granatapfel\u00a4200g\u00a41" 

if extract string values innerobject, e.g.

nsstring *s = innerobject["list"][0]; nslog(@"%@", s); 

then see values stored correctly.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -