Skip to content

Commit

Permalink
Add some more examples to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Apr 7, 2019
1 parent 7c8e79c commit 8f1951a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ To generate infinite records, use:
- fromFile(fileName)
- fromRegex(pattern)

### Examples

Using `fromFile` and `oneOf`:

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

Nesting calls to create objects:

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

Using `object` with various providers:

```
↪ 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"}}
```

## Installation

Expand Down

0 comments on commit 8f1951a

Please sign in to comment.