Category: Web function
This function returns TRUE if the argument can be parsed as a JSON object or JSON array. Otherwise, it returns FALSE.
Argument | Type | Description |
---|---|---|
text | Text | The string being tested as JSON or a JSON object . |
Return value type: Boolean (TRUE/FALSE).
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