1.2.2 Predicates
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog JSON library
        • Supporting JSON
          • library(json_schema): JSON Schema reader and validator
            • Predicates
              • json_validate/3
              • json_compile_schema/3
              • json_check/3
Availability::- use_module(library(json_schema)).(can be autoloaded)
Source[semidet]json_check(+Spec, ?JSON, +Options)
Validate a JSON object. Spec is a Prolog representation of the schema that is optimized for validation. This representation is derived from JSON data using json_compile_schema/3. Options:
on_error(Mode)
What to do if an error is found. Defined modes are
error
Raise an exception. This is the default. Note that only the first error is reported this way.
warning
Print a message
silent
Fail
value_string_as(Type)
Same as for json_read/3.

This predicate is often used through validate_json_dict/3, which mantains a cached mapping from the JSON Schema to Spec.