TCL/C extension for parsing JSON Contact: neophytos (at) gmail (dot) com https://github.com/jerily/tjson%|%tjson git repo%|% ====== # Parse JSON string and return a simple TCL dictionary or a typed one. # ::tjson::parse json_string ?simple? ::tjson::parse {{"a": 1, "b": true, "c": [1, 2, 3], "d": {"d1":"a", "d2":"b"}}} => M {a {N 1} b {BOOL 1} c {L {{N 1} {N 2} {N 3}}} d {M {d1 {S a} d2 {S b}}}} ::tjson::parse {{"a": 1, "b": true, "c": [1, 2, 3], "d": {"d1":"a", "d2":"b"}}} true => a 1 b 1 c {1 2 3} d {d1 a d2 b} ::tjson::parse "{{"a": 1, "b": true, "c": [1, 2, 3], "d": {"d1":"a", "d2":"b"}}" true # Serialize a typed TCL spec to JSON. # ::tjson::to_json typed_spec ::tjson::to_json {M {a {N 1} b {BOOL 1} c {L {{N 1} {N 2} {N 3}}} d {M {d1 {S a} d2 {S b}}}}} => {"a": 1, "b": true, "c": [1, 2, 3], "d": {"d1": "a", "d2": "b"}} ======