Skip to content

json

json(constraints): Dependent<JsonValue>

It returns an arbitrary that generates valid json.

Example

random(json())
// => {}
random(json())
// => {"i|": false}
random(json({type: 'array'}))
// => [false]

Parameters

constraints

MaybePartial<JsonGenerator> = {}

Returns

Dependent<JsonValue>

A json arbitrary.