Quick Start (Command Line)

Module ranjg can be used on command line.

If you haven’t installed ranjg yet, install it with the following command:

$ pip install ranjg

Then, you can generate values according to ranjg-JSON-schema with following command.

$ python -m ranjg ./schema.json

The ./schema.json specified in the above example should be created in advance according to ranjg-JSON-schema. For example:

{
  "type": "object",
  "required": ["name"],
  "properties": {
    "name": { "type": "string", "minLength": 1 },
    "age": { "type": "integer", "minimum": 0 },
  }
}

If you want to save the generated values to a file in JSON format, specify the option --json_output. In the following example, generated.json will be generated in the current directory and the values generated by ranjg will be written.

$ python -m ranjg ./schema.json --json_output ./generated.json

You can also use --options <options_file> option to specify generation rules that are not specified in the schema. See also Options.