This question already has an answer here:
- How to parse JSON using Node.js? 24 answers
Im new to node.js and I can not figure out how to parse the following JSON structure:
{"ss":[ ["Sun","YYY","10","XXX","27","57142","17","16"],["Sun","AAA","20","BBB","24","57144","17","20"] ]}
I have the following so far.
if (!error && response.statusCode === 200) {
console.log(body) // Print the json response
try {
var profile = parseJson(body);
console.log(profile)
} catch(error) {
console.log("ERROR 1")
}
} else {
console.log("ERROR 2")
}
The output at the first console.log (console.log(body)) outputs the entire JSON array as desired.
After that the parseJson(body) does not work and the "Error 1" is thrown and caught.
Can anyone provide any insight!?
via iosforme
No comments:
Post a Comment