Get to know MDN better
Since March 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
The JSON.isRawJSON() static method tests whether a value is an object returned by JSON.rawJSON().
The value to test.
true if value is created by JSON.rawJSON(); otherwise, false.
"Raw JSON" objects, when serialized to JSON, are treated as if they are already a piece of JSON. Furthermore, because of the way JSON.rawJSON() works, the raw JSON is guaranteed to be syntactically valid JSON. For more information on the shape and behavior of raw JSON objects, see JSON.rawJSON(). This method exists to allow other serialization libraries to implement similar behavior to JSON.stringify() for raw JSON objects.
The following example demonstrates how to use JSON.isRawJSON() to test whether an object was returned by JSON.rawJSON(). It implements a custom serializer that serializes data to a YAML-like format.
If in the above example, the userId values were not created by JSON.rawJSON(), but passed as numbers directly, then we will get loss of precision upfront because of JS floating point precision limitations.
| JSON.parse source text access # sec-json.israwjson |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 10, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.