JSON Field
The BPC provides a multi-line JSON editor. This field automatically validates the input and provides assistance in case of syntax errors.
Usage
To use this field, simply create a component with the xtype bpcJsonField.
Copy & Paste Example
Ext.create({
xtype:"window",
autoShow: true,
title: "JSON Field",
layout: "fit",
width: 500,
height: 300,
items:[
{
xtype: "bpcJsonField",
value: {
"number": 1,
"array":[],
"object":{},
"string": "I'm a JSON object"
}
}
]
});
JSON Schema Validation
Optionally, validation against a JSON schema (https://json-schema.org/) can also be performed.
To do this, the jsonSchema attribute must also be specified.
The schema can be specified as a URL or passed directly as a JSON object.
Copy & Paste Example
Ext.create({
xtype:"window",
autoShow: true,
title: "JSON Field",
layout: "fit",
width: 500,
height: 300,
items:[
{
xtype: "bpcJsonField",
jsonSchema: {
"type": "object",
"required": [
"first-name",
"address",
"last-name"
]
},
value: {
"first-name":"John",
"address" : "Foo Ave... (delete one item to get an error)",
"last-name": "Doe"
}
}
]
});
Keywords: