Skip to content
Given a JSON Schema, provide a random valid instance
CoffeeScript JavaScript
Find file
Latest commit 6780503 @mgax mgax Merge pull request #4 from mgax/improvements
Improvements for the Open Contracting project
Failed to load latest commit information.
.gitignore public release
LICENSE public release insert the schema id
cli.js disable the randomness
index.js cleanup insert the schema id
package.json parse arguments with minimist

JSON Schema random

Given a JSON Schema (draft 04), provide a random valid instance.


This is an choppy piece of software, that is in need of some care and affection.


  • format
  • uniqueItems
  • $ref
  • patternProperties
  • dependencies
  • allOf
  • anyOf
  • oneOf
  • not


npm install json-schema-random


# Return a generated JSON instance to stdout of the JSON_SCHEMA_FILE
json-schema-random JSON_SCHEMA_FILE
# Or, in your source code
generate = require 'json-schema-random'
generate {type: 'number'}

Command-line options

--schemaid - set $schema field to id found in the schema document

--no-additional - don't generate fields for additionalProperties

--no-random - return blank values instead of random


Apache 2.0

Something went wrong with that request. Please try again.