Switch to: V12V11V10V9V8V7V6V5

JSON Functions

JSON_BUILD_ARRAY( [inValue1,...,inValueN] )

Creates a JSON array from the list of input arguments.

SELECT json_build_array('foo',1,'bar',2, TRUE)
=> '["foo",1,"bar",2,true]'

JSON_BUILD_OBJECT( [inKey1, inValue1,..., inKeyN, inValueN] )

Creates a JSON object from the list of input arguments.

SELECT json_build_object('foo',1,'bar',2)
=> '{"foo":1,"bar":2}'

JSON_EXTRACT_PATH( inStr, inPath [, inDelimiter = ','] )

Returns JSON value pointed to by inPath.

SELECT json_extract_path( '{"foo":1,"bar":2}', 'bar')
=> 2
SELECT json_extract_path('[11,"25",null]', 2)
=> "25"

JSON_FORMAT( inStr )

Returns formatted JSON text.

SELECT json_format( '[{"f1":1,"f2":null},2,null,3]' )
=>
[{
		"f1":	1,
		"f2":	NULL
	}, 2, NULL, 3]

JSON_LENGTH( inStr )

Returns the number of elements in the outermost JSON array (size of array if function was successfully completed, otherwise null) or object.

SELECT json_length( '[1,2,3,{"f1":1,"f2":[5,6]},4]' )
=> 5

JSON_TYPEOF( inStr )

Returns the type of the outermost JSON value as a text string. Possible types are object, array, string, number, boolean, and null.

SELECT json_typeof( '-123.4' )
=> 'number'