| Extracted from Pike v7.8 release 866 at 2018-02-09.

[Top]
Standards
Standards.JSON

# Method Standards.JSON.validate_utf8()

Method validate_utf8

  `int validate_utf8(string s)`

Description

  Checks if a string is valid utf8 encoded 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 integer position inside the string where the error occurs is returned.