You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JSON5 is able to stringify objects, arrays, strings, numbers, Booleans, and nulls. Anything else, including functions and symbols, should return undefined. It should only throw when you have a circular reference or when the replacer argument is truthy but neither function nor array.
What are you passing into stringify that is causing it to throw, and what is the error message?
I might patch this soon if it's an easy fix, but in the meantime, you could use JSONext. It supports JSON5 syntax but also supports Unicode keys and includes some ES6 features. It doesn't suffer from this bug as you can see in this updated example: https://jsfiddle.net/j1156ewj/2/
If I do
JSON5.stringify(json)
whenjson
doesn't haveObject.prototype
, it will fail. I can work around it by doing something like:But I feel like this library should be able to stringify JSON structures event if they aren't Objects. If you don't agree, feel free to close this.
The text was updated successfully, but these errors were encountered: