Following works in nodejs 4.2.3. But I don't see any documentation saying 
JSON.parse() accepts a buffer. Is this behavior guaranteed but not 
documented oris there something I'm doing wrong? 

o = {"tes": 1, "4 byte utf8": "𠜎 𠜱 𠝹 𠱓"};    // { tes: 1, '4 byte 
utf8': '𠜎 𠜱 𠝹 𠱓' }
buffer = new Buffer(JSON.stringify(o), 'utf8');  // <Buffer 7b 22 74 65 73 
22 3a 31 2c 22 34 20 62 79 74 65 20 75 74 66 38 22 3a 22 f0 a0 9c 8e 20 f0 
a0 9c b1 20 f0 a0 9d b9 20 f0 a0 b1 93 22 7d>
JSON.parse(buffer);       // { tes: 1, '4 byte utf8': '𠜎 𠜱 𠝹 𠱓' }

Thanks

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/b322c153-ef30-45d8-a819-34b5b3d4ea8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to