Skip to content

Latest commit

 

History

History
28 lines (17 loc) · 894 Bytes

File metadata and controls

28 lines (17 loc) · 894 Bytes

JSON.stringify

The JSON.stringify() method converts a JavaScript value to a JSON string, optionally replacing values if a replacer function is specified or optionally including only the specified properties if a replacer array is specified.

Syntax

JSON.stringify(value)
JSON.stringify(value, replacer)
JSON.stringify(value, replacer, space)

Return value

A JSON string representing the given value, or undefined.

Stringify native objects

Minecraft has modified JSON.stringify function so that when stringify a native object, it always return {}.

A workaround is to deep copy the JSON object. Highly recommend using this package to display native objects in string.

Learn more

Resources are obtained from here:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify