objective c - Why NSJSONSerialization uses NSData instead of NSString? -


is there reason nsjsonserialization use nsdata instead of nsstring representing json data?

nsstring seems more obvious choice me...

i imagine more efficient encourage parsing nsdata instead of nsstring. if parsing response server, example, you'll nsdata object representing buffer of raw bytes returned server (note nsjsonserialization includes method parsing nsinputstream directly). parsing whole thing nsstring waste since intermediate object thrown out. instead, nsjsonserialization parsing bytes in nsdata object directly , construct nsstrings appropriate keys , values in resulting data structure.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -