tcvJSON is derived from the json module found in tcllib. The fundamental problem with tcllib is while it does a great job at parsing JSON data, it does so in a way that does not maintain the JSON structure unambiguously in Tcl. That is, going from JSON to Tcl and back to JSON is not possible. tcvJSON was written as an enhanced version of the json module in tcllib to address these issues.
This it does by tagging each ambiguous part of a JSON structure with a type. There is a type for numbers, strings, arrays, and objects. The bare words “true,” “false,” and “null” retain their meaning without tags. Everything else is qualified with some kind of tag indicating its types. This allows us to unambiguously convert JSON to Tcl, manipulate the result with Tcl commands, and finally convert back to JSON while maintaining the original structure, plus any intended structure added while it was in the Tcl representation.
Appends thing onto the end of the JSON list stored in jsonName. Signals an error if the value of jsonName is not a JSON array.
Adds the key/value pair given to the JSON object stored in jsonName. Signals an error if the value of jsonName is not a JSON object.
Writes the JSON representation of the data stored in jsonName out on channel (or stdout if not provided).
Parse the text stored in txt and return a Tcl representation of that JSON data.