Prism · Objects

$type

Names what kind of value something is: string, number, boolean, null, array or object.

The source
{
  text: 'hello',
  count: 3,
  on: true,
  nothing: null,
  list: [1, 2],
  record: { a: 1 },
}
The config
{
  text: { $type: { $ref: '$.text' } },
  count: { $type: { $ref: '$.count' } },
  on: { $type: { $ref: '$.on' } },
  nothing: { $type: { $ref: '$.nothing' } },
  list: { $type: { $ref: '$.list' } },
  record: { $type: { $ref: '$.record' } },
}
What comes out
{
  text: 'string',
  count: 'number',
  on: 'boolean',
  nothing: 'null',
  list: 'array',
  record: 'object',
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.