Here is my json{"name":"John","age":30,"cars": [{ "name":"Ford", "models":[ "Fiesta", "Focus", "Mustang" ] },{ "name":"BMW", "models":[ "320", "X3", "X5" ] },{ "name":"Fiat", "models":[ "500", "Panda" ] }]}And this is my codevar fs = require('fs');var json = fs.readFileSync('decodedjson.txt', 'utf16le');var jobj = JSON.parse(JSON.stringify(json));console.log(jobj.name);Cant access any fields from the json object. It's been 3 hours, I can't figure it out..
Submitted September 13, 2018 at 06:33PM by Roo_ooky
No comments:
Post a Comment