08-04-2022 11:13 AM
It's been suggested that I think about adding a basic JSON validation schema capability to JSONtext. What do people think?
An example:
{ "type": "object", "properties": { "number": { "type": "number" }, "street_name": { "type": "string" }, "street_type": { "enum": ["Street", "Avenue", "Boulevard"] } } }
08-05-2022 08:30 AM
08-05-2022 10:20 AM
@Thoric wrote:Would you interpret the schema during parsing, on demand, or just include it for the developer's benefit?
There would be a new "Validate JSON Schema" VI, that would have inputs for both a JSON Schema, and a JSON Value to validate (ie. it is used on demand). Would return "Valid" T/F, and hopefully reason for it not being valid.
A JSON Schema can specify things like "must include certain items", or "'Temperature' must be a number", or "'Position' must be an array of three numbers".
08-05-2022 10:24 AM
Could also have a "Generate JSON Schema from LV Datatype" subVI, that would generate the Schema from an input type (including things like cluster names and types, and enum values). This could be used be a programmer in a different language to validate that their JSON is in the right form to be understood in LabVIEW.
08-07-2022 03:32 PM
02-08-2023 09:01 AM
I love JSON Schema and would love this feature to more easily validate configuration files.
06-01-2023 04:52 AM
08-30-2023 07:58 AM
I'd like this very much as well
11-23-2023 01:09 PM - edited 11-23-2023 01:10 PM
Here is a beta version with JSON Schema. See the example "JSON Schema Validation".
11-24-2023 03:35 AM