Skip to content

Tag: stringify

JSON.parse incorrect string format

i have this string: and i want it to become like this: I tried with stringify and replace and i ended up with And from here i wanted to replace the single quotation marks ‘ with double quotation marks ” but when i did, in beginning and ending of the string appeared an extra ” Any tips on how…

how to create a table with a concatenated array

Currently i have a btn which calls a function as follows: this gets information from a bunch of arrays as follows: when the button is clicked it returns [Object, object] back to the “resultsDiv”.I have researched how to put this either in a list / table with the concatinated results but the only t…

Download Object As Formatted JSON File

I followed this guide to download a JSON object from the browser. This is what my code looks like: But this gives me a single line file that is hard to read. Is there an easy way to format it as a readable JSON file, with newlines and indentation? Answer The JSON.stringify has three parameters, you can use th…

How to stringify event object?

JSON.stringify(eventObject); gives: TypeError: Converting circular structure to JSON dojox.json.ref.toJson(eventObject); gives: TypeError: Accessing selectionEnd on an input element that cannot have a selection. Is there some library/code ready to use to accomplish it ? Answer You won’t be able to seria…