Convert JavaScript (or TS runtime) classes that assign defaults into JSON Schema, then open the Mock Generator to craft matching sample data.
Need JSON to JavaScript?
Turn JSON payloads into reusable JS objects.
Paste your JavaScript class definitions to produce JSON Schema instantly.
Supports ES6 classes with constructor assignments or class field syntax.
Paste ES6 classes that assign fields in the constructor (this.field = value) or use class field syntax (field = value). The parser infers JSON Schema types from literal assignments such as strings, numbers, booleans, arrays, and object literals.
Literal values set the schema type (for example, "" => string, 0 => integer, [] => array). Non-literal assignments fall back to string and are marked optional. Arrays become schema arrays with generic elements, and object literals become maps.
If your TypeScript classes include literal default values, the parser works as well, but for type annotations we recommend the TypeScript Class → JSON Schema tool. This JavaScript converter focuses on runtime assignments.
After generating the schema, click "Generate Mock Data" to open the Mock Generator with the schema preloaded. Configure locales, array sizes, and optional fields to create example payloads in seconds.