Forum OpenACS Development: Re: Error: invalid command name "json::json2dict"

Collapse
Posted by Gustaf Neumann on
Iuri,

you seem to mix up the APIs of the various json implementations for Tcl. If you want to use rl_json, use "json get ..." [1]. If you want to use tdom to parse json, use "dom parse -json ..." [2]. If you want to use tcllib's json implementation, use "::json::json2dict ..." [3]. In your snippet above, you seem to use pieces of all of these.

The reason, you are seeing the error message 'invalid command name "json::json2dict"' is that "package require json" is missing (see [3]) is missing in your script.

-g

[1] https://github.com/RubyLane/rl_json
[2] http://www.tdom.org/index.html/doc/trunk/doc/dom.html
[3] https://core.tcl-lang.org/tcllib/doc/tcllib-1-18/embedded/www/tcllib/files/modules/json/json.html

Collapse
Posted by Iuri Sampaio on
Indeed. A total mess! I was writing [1], [2] and [3], in the same script in order to evaluate all methods to parse a json input, then I made confusion with variable names.

I must avoid that bu commenting the code I write. Thanks

Btw, after I've cleaned the snnipet and added "package require json", the error is gone. https://iurix.com/ctree/import-sample

Best wishes,
I