Skip to content

Tag: json

Parse XLSX with Node and create json

Ok so I found this really well documented node_module called js-xlsx Question: How can I parse an xlsx to output json? Here is what the excel sheet looks like: In the end the json should look like this: index.js: Answer Improved Version of “Josh Marinacci” answer , it will read beyond Z column (i.…

Can’t parse JSON to Javascript object

I have this HTML box: Event onchange() implementation: But when onchange() event is fired I get on this row: This error: SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data return JSON.parse( data + “” ); Any idea why I get error above? Answer In your case you don&#82…

Fetch: POST JSON data

I’m trying to POST a JSON object using fetch. From what I can understand, I need to attach a stringified object to the body of the request, e.g.: When using jsfiddle’s JSON echo I’d expect to see the object I’ve sent ({a: 1, b: 2}) back, but this does not happen – chrome devtools…

How do you JSON.stringify an ES6 Map?

I’d like to start using ES6 Map instead of JS objects but I’m being held back because I can’t figure out how to JSON.stringify() a Map. My keys are guaranteed to be strings and my values will always be listed. Do I really have to write a wrapper method to serialize? Answer Both JSON.stringif…

How to access first element of JSON object array?

I exptect that mandrill_events only contains one object. How do I access its event-property? Answer To answer your titular question, you use [0] to access the first element, but as it stands mandrill_events contains a string not an array, so mandrill_events[0] will just get you the first character, ‘[&#…