Well, you cannot. The problem is than when converting json to a tcl
dict, information about the value types is lost.
My suggestion is to use another json package. I think your best chance
is rl_json:
https://github.com/RubyLane/rl_json
You can generate json from a dict, if you provide a template, and you
can parse json into an internal representation stored as a new tcl
object type. This means you can change a json value, without converting
into a tcl dict first.
For example:
set json {some json data}
With rl_json::json get $json ?key1? ?key2? ...
you can get dict functionality without converting json into a dict.
And with:
rl_json::json set json key1 key2 value
You can modify what is in the json variable. When uou ask for the string
of the json variable, it will always be valid json data (even if you
modify it).
Just using "rl_json::json get {some json data}" is the equivalent of
json::json2dict. Also, in some simple measurements I have done (for
generating json), rl_json was faster than tcllib's json::write.
George