class method Object.toJSON
Object.toJSON(object) → String
-
object
(Object
) – The object to be serialized.
Returns a JSON string.
undefined
and function
types have no JSON representation. boolean
and null
are coerced to strings.
For other types, Object.toJSON
looks for a toJSON
method on object
.
If there is one, it is used; otherwise the object is treated like a
generic Object
.