Checks whether a string is a valid JSON string.
Syntax
boolean json_valid(<string>)
Parameters
string: required. This parameter specifies the JSON string that you want to process.
Return value
The return value is true or false, which is of the BOOLEAN type.
Examples
Example 1: Check whether
"abc"
is a valid JSON string.select json_valid('"abc"');
The following result is returned:
+------+ | _c0 | +------+ | true | +------+
Example 2: Check whether
abc
is a valid JSON string.select json_valid('abc');
The following result is returned:
+------+ | _c0 | +------+ | false | +------+
Related functions
JSON_VALID is a complex type function. For more information about the functions that are used to process data of complex data types, such as ARRAY, MAP, STRUCT, and JSON, see Complex type functions.