User Rating 0.0
Total Usage 0 times

Input JavaScript

Result (Plain JSON)

Ready 0 keys
Is this tool helpful?

Your feedback helps us improve.

About

In the ecosystem of JavaScript libraries, not everything is a plain object. Libraries like jQuery and Express often use Hybrid Objects - functions that double as objects with attached properties. While powerful, these structures break standard serialization tools like JSON.stringify, which ignores properties attached to functions.

This tool implements a recursive sanitization algorithm. It takes any JavaScript variable - x - and projects it onto a pure plain object space P. It strips away the prototype chain (optional), methods, and non-enumerable artifacts, leaving you with the raw data structure. It is the definitive solution for converting "Object-like" variables into true, portable JSON.

javascript json debugging object-sanitizer web-development

Formulas

The core logic maps an input entity E to a plain object O by iterating over the set of enumerable keys K.

O {
E if E Primitivesk ∈ K krecurse(E[k]) otherwise

Reference Data

Input TypeStandard JSON.stringifyThis Tool (toObject)
Plain ObjectOKOK
Function w/ Propsundefined (Ignored){ props... }
Class InstanceSerializedSerialized (Clean)
Circular RefError[Circular] (Handled)
Date ObjectISO StringISO String
DOM ElementError / Empty{ nodeName... }

Frequently Asked Questions

By the JSON standard, functions are not valid data types. If you attach properties to a function (e.g., `func.id = 5`), the serializer ignores the function entirely. This tool extracts those attached properties into a new plain object.
Yes. The algorithm tracks visited objects in a `WeakSet`. If a circular reference is detected, it is replaced with a placeholder string "[Circular]" instead of crashing the browser.
The tool uses `new Function()` to interpret the code you paste. This runs entirely in your browser (client-side). No code is sent to any server. However, you should only paste code you trust or have written yourself.
Yes. It will treat an instance of a class as an object and extract its enumerable properties. Note that internal private fields (#field) cannot be accessed by external tools.