您的位置:首页 > Web前端 > JavaScript

[ Tcl ] dict 和 JSON 相互转换

2022-03-10 23:46 2943 查看

https://www.cnblogs.com/yeungchie/

Tcl 的资料是真难查,终于在 tcltk 的 github 找到了用法 tcltk/tcllib: tcllib (Mirror of core.tcl-lang.org).

json

package require json
package require json::write

json::dict2json

set dict [dict create a 1 b 2 c 3]
# a 1 b 2 c 3

set jsonDict [json::dict2json $dict]
# {"a": 1
# ,"b": 2
# ,"c": 3
# }

json::json2dict

puts [json::json2dict $jsonDict]
# a 1 b 2 c 3
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: