Checks the validity of a JSON string.
// Check if the JSON string is valid
IF JSONValid(sJSON) THEN
// Yes => Initialize JSON variable
oJSON is JSON = StringToJSON(sJSON)
...
END
Syntax
<Result> = JSONValid(<JSON string>)
<Result>: Boolean
- True if the JSON string is valid,
- False otherwise. If an error occurs, use ErrorInfo for more details on the error.
<JSON string>: Character string
String containing the JSON data (7-bit ASCII + JSON or UTF-8 encoding).
Remarks
Encoding
The encoding used corresponds to the JSON standard:
- 7-bit ASCII encoding for the first 128 characters, i.e., unaccented characters
- JSON encoding for the other characters: "\u" followed by the character code in 4-byte hexadecimal format. Example: for the "é" character (ASCII code 233, hexadecimal code E9), the encoding corresponds to "\u00E9".