JSON

This field can be used to enter and display JSON data. The value is parsed using JSON.parse before it is returned, and stringified before it is displayed.

Example

{ type: "json", label: "JSON" }

Options

Input

Use these options when using the field with take.

key?
string
A key to access the value. If provided, each field must have a unique key. See make for more information about accessing values.
label?
string |‌ false
A label describing the purpose of the field. Setting the label to false removes the element, which can be useful when nested as the only child within a group.
detail?
string
Additional information about the field, disclosed in a tooltip.
required?
boolean
Whether or not this field is required.
value?
string
The initial value of the field.
placeholder?
string
Add placeholder text to prompt the user when the field is empty.
spellcheck?
boolean
Enable or disable the browser’s spellchecking feature.
pattern?
string
A regular expression that the input value must match in order for the value to pass validation.
maxlength?
number
The maximum number of characters the user can enter into the input.
autocorrect?
"on" |‌ "off"
Enable or disable the browser’s autocorrecting feature. When spellcheck is false, the default value is "off". See MDN for more details.
autocapitalize?
"none" |‌ "off" |‌ "on" |‌ "sentences" |‌ "words" |‌ "characters
Enable or disable the browser’s autocapitalizing feature. When spellcheck is false, the default value is "off". See MDN for more details.

Output

Use these options when using the field with make.

label?
string |‌ false
A label describing the purpose of the field. Setting the label to false removes the element, which can be useful when nested as the only child within a group.
detail?
string
Additional information about the field, disclosed in a tooltip.
value?
string
The output value of the field.
replacer?
function |‌ array
Control how values are stringified, or the properties that are included in the output. See MDN for more details.
space?
number |‌ string
Control the way white space is inserted into the JSON text. See MDN for more details.

Data

A JSON field will always return an object or array. If the value is null or undefined, an empty object is returned. If the value cannot be parsed, an empty object is returned. Values must conform to the JSON specification, meaning object keys must use quotes.