isJSONObject es-toolkit
Checks if a value is a valid JSON object.
Usage
isJSONObject(value)
Use isJSONObject when you want to check if an object has string keys and all values are valid JSON values. A valid JSON object is a plain object consisting only of string keys and JSON-serializable values (null, objects, arrays, strings, numbers, booleans).
Accurately distinguishes invalid JSON objects containing non-JSON-serializable values like functions, Symbol, Date objects, undefined, or class instances.
Can be used to validate safe usage of JSON.stringify.
isJSONObject has a different purpose than other object checking functions. isPlainObject checks if it's a plain object, while isJSONObject checks if it's an object that can be JSON-serialized.
Parameters
The value to check if it's a valid JSON object.
Returns
Returns true if the value is a valid JSON object, false otherwise.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.