JSON::type

Description

This command gets the type of the given JSON element (aka. JSON value).

Note

A return value of ‘invalid’ signifies an issue while parsing the value, or an empty element has been c reated and not yet assigned a value (using ‘JSON::root’ on an empty tree, for example).

Syntax

JSON::type <JSON_ELEMENT>

JSON::type

  • Returns a string representing the JSON type (‘null’ | ‘boolean’ | ‘integer’ | ‘literal’ | ‘string’ | ‘object’ | ‘array’ | ‘invalid’).

Examples

when JSON_REQUEST {
    set rootval [JSON::root]
    JSON::set $rootval string HelloWorld
    set type [JSON::type $rootval]
}