Ruby Class to JSON Schema Generator

Need JSON to Ruby?

Convert JSON data to Ruby code

JSON → Ruby Classes

Ruby code Input

Loading...

JSON Schema Output

Paste your Ruby classes to produce JSON Schema instantly.

Supports attr_accessor/attr_reader declarations, nested classes, and ignored methods.

Frequently Asked Questions

What Ruby constructs are supported?

The parser focuses on classes that expose attributes via attr_reader/attr_accessor declarations. Each attribute becomes a JSON Schema property. Methods and other Ruby code are ignored, so you can paste plain model classes safely.

How are attributes typed?

Since Ruby is dynamic, attributes default to `string` in the schema. You can refine types by providing literal defaults; future updates will read type comments. For now this tool provides a quick structural schema for DTOs.

Why use this tool?

When sharing Ruby domain objects or ActiveModel-like DTOs with other teams, a JSON Schema helps document payloads and validate contracts. This converter runs entirely in your browser.

How do I get mock JSON payloads?

After generating the schema, click "Generate Mock Data" to open the Mock Generator with the schema preloaded and create example payloads instantly.