User Tools

Site Tools


syntax:functions:isjson

IsJSON(text)

Category: Web function


Description

This function returns TRUE if the argument can be parsed as a JSON object or JSON array. Otherwise, it returns FALSE.


Arguments

ArgumentTypeDescription
text Text The string being tested as JSON or a JSON object .

Return value type: Boolean (TRUE/FALSE).


Examples

isjson( '{}' )  //Returns TRUE
isjson( 'JSON' )  //Returns FALSE
isjson( 'a:{b:1}' )  //Returns FALSE
isjson( '{a:{b:1}}' )  //Returns TRUE
isjson( '1,"a"' )  //Returns FALSE
isjson( '[1,"a"]' )  //Returns TRUE


See also

syntax/functions/isjson.txt · Last modified: 2021/09/18 19:59 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki