{ "id": 123, "name": "John Doe", "email": "[email protected]", "active": true, "created_at": "2023-01-01T00:00:00Z" }
This tool converts JSON objects into AJV schema, properly handling nested objects and arrays of objects. It generates schemas compatible with strict mode.
const ajv = new Ajv({ strict: false, // or "log" to warn instead of error useDefaults: "empty", coerceTypes: true/false, allErrors: true, removeAdditional: true/false });Adjust the schema as needed based on your specific Ajv settings.
{ "id": 123, "name": "John Doe", "email": "[email protected]", "active": true, "created_at": "2023-01-01T00:00:00Z" }
{ "id": 123, "name": "John Doe", "company": { "id": 456, "name": "Acme Inc", "employees": [ { "id": 789, "name": "Jane Smith", "role": "Developer" }, { "id": 790, "name": "Bob Johnson", "role": "Designer" } ], "locations": ["New York", "London", "Tokyo"] } }