Is this the valid json file format? I couldn't read it using json.parse unless I change it suffix from .json to .js [closed]
users.json
const userContent = `
[{"id":1,"user":{"firstname":"Jacquette","lastname":"Marion","email":"jmarion0@nyu.edu","address":"207 Ryan Avenue","city":"Lubbock","state":"Texas","zip":"79491"},"portfolio":[{"symbol":"NKE","owned":483},{"symbol":"NKE","owned":512},{"symbol":"K","owned":562},{"symbol":"GE","owned":288},{"symbol":"PSX","owned":465},{"symbol":"FDX","owned":263},{"symbol":"AAPL","owned":688},{"symbol":"NFLX","owned":828},{"symbol":"NFLX","owned":-211},{"symbol":"APC","owned":994}]},
{"id":2,"user":{"firstname":"Vaughan","lastname":"Main","email":"vmain1@alexa.com","address":"56 Loeprich Drive","city":"Midland","state":"Texas","zip":"79705"},"portfolio":[{"symbol":"HAL","owned":775},{"symbol":"FB","owned":459}]},
{"id":3,"user":{"firstname":"Matthus","lastname":"Harnes","email":"mharnes2@newyorker.com","address":"75504 Briar Crest Plaza","city":"Arlington","state":"Texas","zip":"76016"},"portfolio":[{"symbol":"MCD","owned":825},{"symbol":"TRIP","owned":728},{"symbol":"XEL","owned":110},{"symbol":"GE","owned":582},{"symbol":"WYN","owned":616},{"symbol":"GS","owned":1088}]},
{"id":4,"user":{"firstname":"Bernette","lastname":"Manson","email":"bmanson3@macromedia.com","address":"1333 Red Cloud Avenue","city":"Seattle","state":"Washington","zip":"98115"},"portfolio":[{"symbol":"EBAY","owned":372},{"symbol":"NFLX","owned":801},{"symbol":"DAL","owned":905},{"symbol":"V","owned":127},{"symbol":"FDX","owned":846},{"symbol":"PEP","owned":612},{"symbol":"GOOGL","owned":490}]},
{"id":5,"user":{"firstname":"Luisa","lastname":"Dungey","email":"ldungey4@oakley.com","address":"0799 Del Mar Crossing","city":"Houston","state":"Texas","zip":"77212"},"portfolio":[{"symbol":"YUM","owned":470},{"symbol":"ZION","owned":-69},{"symbol":"EBAY","owned":719}]}
]`;
I'm a beginner of javascript
Via Active questions tagged javascript - Stack Overflow https://ift.tt/kdCn58I
Comments
Post a Comment