json_validate
- Синтаксис
-
native bool:json_validate(const JSON:schema, const JSON:value);
Переменная | Описание |
---|---|
schema |
JSON handle |
value |
JSON handle |
- Описание
- Validates json by checking if object have identically named fields with matching types.
- Пометка
-
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.
- Возвращает
- True if passed value is valid, false otherwise