All Projects → mfussenegger → mkjson

mfussenegger / mkjson

Licence: MIT license
A commandline tool to generate static or random JSON records

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to mkjson

Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+214456.25%)
Mutual labels:  fake, faker, faker-generator
faker-buzzword-job-titles
👔 A job title generator for faker based on Buzzwords.
Stars: ✭ 14 (-12.5%)
Mutual labels:  fake, faker
FakerDotNet
A .NET port of the Ruby faker gem
Stars: ✭ 15 (-6.25%)
Mutual labels:  fake, faker
Bogus
📇 A simple and sane fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Stars: ✭ 5,083 (+31668.75%)
Mutual labels:  fake, faker
random
Random data generator AKA faker
Stars: ✭ 14 (-12.5%)
Mutual labels:  fake, faker
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+1231.25%)
Mutual labels:  fake, faker
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+21393.75%)
Mutual labels:  fake, faker
fastfaker
Fast, concurrent fake data generator for any structure or type.
Stars: ✭ 21 (+31.25%)
Mutual labels:  faker, faker-generator
Fakerator
Random fake data generator with localization for Javascript in Node.js and browser
Stars: ✭ 91 (+468.75%)
Mutual labels:  fake, faker
Faker
A library for Dart that generates fake data.
Stars: ✭ 103 (+543.75%)
Mutual labels:  fake, faker
Fake Apache Log Generator
Generate a boatload of Fake Apache Log files very quickly
Stars: ✭ 207 (+1193.75%)
Mutual labels:  fake, faker
faker
Generate massive amounts of fake data in the browser and node.js
Stars: ✭ 6,940 (+43275%)
Mutual labels:  fake, faker
blaver
A JavaScript library built on top of the Faker.JS library. It generates massive amounts of fake data in the browser and node.js.
Stars: ✭ 112 (+600%)
Mutual labels:  faker, faker-generator
Faker.NET.Portable
C# port of the Ruby Faker gem (http://faker.rubyforge.org/)
Stars: ✭ 22 (+37.5%)
Mutual labels:  fake, faker
fake-web-events
Creates a Simulation of Fake Web Events
Stars: ✭ 48 (+200%)
Mutual labels:  faker, faker-generator
minifaker
A lightweight alternative to faker.js
Stars: ✭ 64 (+300%)
Mutual labels:  fake, faker
faker
A set of javascript packages that generates fake data for you.
Stars: ✭ 33 (+106.25%)
Mutual labels:  faker, faker-generator
useragent-generator
Easily generate correct user-agent strings for popular browsers
Stars: ✭ 62 (+287.5%)
Mutual labels:  fake, faker-generator
Joal
An open source command line RatioMaster with an optional WebUI.
Stars: ✭ 213 (+1231.25%)
Mutual labels:  fake, faker
jedi-faker
Faker extension for Star Wars junkie
Stars: ✭ 15 (-6.25%)
Mutual labels:  faker, faker-generator

mkjson

CI

mkjson is a CLI to generate JSON records.

Static JSON:

↪  mkjson x=10 y=20 foo=bar
{"foo":"bar","x":10,"y":20}

Generated random data:

↪  mkjson --num 3 id="uuid4()" x="randomInt(0, 10)"
{"id":"2c6ce42f-5f7d-4e65-a1a1-8b39f6cfce19","x":6}
{"id":"d4c1af69-3cdd-417d-98e0-d3774f5fa1be","x":8}
{"id":"8fc064c9-57ba-4d78-b205-57899776e757","x":6}

It takes fieldName=value or fieldName=provider() pairs as argument. Each pair will result in a field within the JSON object.

To generate infinite records, use:

↪  mkjson --num Inf

Examples

Using fromFile and oneOf:

↪  mkjson --num 3 w="oneOf(fromFile('/usr/share/dict/words'))"
{"w":"Karl"}
{"w":"demographic"}
{"w":"calumny's"}

Use dotted notation to create objects:

↪  mkjson point.x=10 point.y=20
{"point":{"x":10,"y":20}}

Or nest calls to create objects:

↪  mkjson obj=$(mkjson xs="array(randomInt(0, 4), randomInt(5, 9))")
{"obj":{"xs":[2,5]}}

Or use the object provider with various providers. Argument are key, value [, ...] pairs:

↪  mkjson obj="object(dt, randomDateTime(), type, fromRegex('[a-z]{4}-\d+'), xs, replicate(5, randomInt(0, 10)))"
{"obj":{"dt":"2099-09-11T16:33:41Z","xs":[6,8,5,2,0],"type":"ldwa-2667786160"}}

You may also want to read this introduction and sample use case.

Available providers

  • uuid1
  • uuid4
  • null
  • randomBool
  • randomChar
  • randomInt(lower, upper)
  • randomDouble(lower, upper)
  • randomDate [(lower, upper)]
  • randomDateTime [(lower, upper)]
  • array(expr [, ...])
  • oneOf(arrayExpr)
  • oneOf(expr, expr [, ...])
  • replicate(number, expr)
  • object(key, value [, ...])
  • fromFile(fileName)
  • fromRegex(pattern)

Installation

Get a pre-build binary from the releases page or build it yourself:

Install stack:

curl -sSL https://get.haskellstack.org/ | sh

Install mkjson:

git clone https://github.com/mfussenegger/mkjson.git
cd mkjson
stack install

Alternatives

There are some alternatives if you're not so interested in the random-value generation aspect of mkjson:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].