You need a JSON Schema for an API response, a config file, a stream of log records — for validation, docs, or contract tests. Hand-writing it is tedious and you'll get it subtly wrong. So you reach for a "JSON to JSON Schema" generator… and it hands you a schema built from one example: every field marked required, every type pinned to whatever that single record happened to contain. The first real payload that omits an optional field fails validation against a schema you just generated.
The problem isn't generating a schema. It's that one example isn't your data. So I built mkschema to merge many samples. Zero dependencies, no network.
$ printf '{"id":1,"name":"Ada","age":30}\n{"id":2,"age":30.5}\n' | npx mkschema --ndjson -
{
"$schema": "https://json-schema.org/draft/2020-12/schema",






