ezjson_validate

Syntax

native bool:ezjson_validate(const EzJSON:schema, const EzJSON:value);

Usage

Parameter Description
schema
EzJSON handle
value
EzJSON handle

Description

Validates json by checking if object have identically named
fields with matching types.

Note

  • Schema {"name":"", "age":0} will validate
    {"name":"Joe", "age":25} and {"name":"Joe", "age":25, "gender":"m"},
    but not {"name":"Joe"} or {"name":"Joe", "age":"Cucumber"}.
  • In case of arrays, only first value in schema
    is checked against all values in tested array.
  • Empty objects ({}) validate all objects,
    empty arrays ([]) validate all arrays,
    null validates values of every type.

Return

True if passed value is valid, false otherwise

Error

If a schema handle or value handle is invalid