2010-09-02 5 views
0
[[["您好世界","Hello world","N n h o sh ji "]],,"en"]  

c'est objet JSON: contentOfResponseDataInJsonValueerreur de validation JSON

Je veux 你好世界. Comment le faire?

NSString *returnStr=[[[[contentOfResponseDataInJsonValue JSONValue] objectAtIndex:0] objectAtIndex:0] objectAtIndex:0] ; 

faire cette erreur:

JSONValue failed. Error trace is: ( "Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Unrecognised leading character\" UserInfo=0x739f0c0 {NSLocalizedDescription=Unrecognised leading character}", "Error Domain=org.brautaset.JSON.ErrorDomain Code=3 \"Expected value while parsing array\" UserInfo=0x739f140 {NSUnderlyingError=0x739f120 \"Unrecognised leading character\", NSLocalizedDescription=Expected value while parsing array}"

Répondre

5

En regardant le syntax chart at json.org, je dirais qu'il est illégal d'avoir deux virgules dans un tableau avec rien entre eux. Votre JSON est mal formé.

[[["您好世界","Hello world","N n h o sh ji "]],,"en"] 
               ^^ not allowed! 

Edit: Juste pour prouver mon point, voici un JSON validator.