Pike v8.0 release 1738

Method Standards.JSON.validate()


Method validate

int validate(string s)

Description

Checks if a string is valid JSON.

Returns

In case the string contains valid JSON -1 is returned. It is then guaranteed to be parsed without errors by decode(). In case the string is not valid JSON, the error position is returned.