The value to stringify.
Optional
replacer: ReplacerPropertyList | NoReplacer | ReplacerFunctionA property list identifying the properties to include in stringification,
a replacer function to call that can modify or eliminate values encoded in
the ultimate stringification, or null
/undefined
if no replacement or
limitation of properties should occur.
If a number, contents will be pretty-printed using that many U+0020 SPACE characters as indentation. Otherwise up to the first ten characters of a supplied string will be used as indentation. If the requested indentation is an empty string, no pretty-printing occurs.
Create an iterable iterator over successive fragments of the JSON stringification of a value, as if JSON.stringify had been passed
value
,replacer
, andspace
and then were returning successive slices of the result. Fragments are iterated until the entire stringification has been returned. Where fragment boundaries occur is explicitly not defined: do not attempt to infer or rely upon boundary locations.If the incremental stringification operations performed to iterate the next fragment throw an exception, that exception will propagate to the caller.
If
value
itself is not stringifiable (e.g. it'sundefined
, a symbol, or is callable) or ifreplacer
doesn't preservevalue
, iteration produces no fragments. (Note that in this caseJSON.stringify
returnsundefined
, not a string.)Therefore if you use this function on insufficiently-restricted values expecting it to produce a concatenated stringification, you must be sure to verify that it actually iterates a fragment.