ztcl::json object
Writes a JSON object from keys and JSON values.
ztcl::json object ?KEY JSON ...?
Description
Gives a JSON object with each KEY and its value. Each value is JSON text, such as the result of another builder, and goes in as it is. With no argument it gives {}.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| KEY | string | none | A key. |
| JSON | JSON text | none | The value of the key before it. |
Returns
The JSON text.
Examples
Each example of this page runs after package require ztcl::json.
% ztcl::json object a [ztcl::json number 1] b [ztcl::json string x]
{"a":1,"b":"x"}
% ztcl::json object
{}
Errors
% ztcl::json object a
wrong # args: should be "ztcl::json object ?key json ...?"
-errorcode TCL WRONGARGS
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1