[Sarnold]: An attempt to produce a Tcl-equivalent to [JSON], a data format easily parsable by Web applications. Here we have a simple code to handle this format at Tcl-level, with a little sugar to handle types, that is required by the [Javascript] version. [Lars H], 2008-02-06: Do you have an example of what the data format looks like? Also, what is the point of doing a more Tclish format in this case? I'd expect it to be easier to teach Tcl to parse a data structure with Javascript syntax than vice versa, but on the other hand it is probably good for the mountain to come to Muhammed every once in a while too. [Sarnold]: The data format maps Tcl's [list]. The structure of the data is separate from the data itself, due to [EIAS]. The data structure is also a [list]. ====== Data structure syntax for Tclon: list : type ?type ...? | list '*' # the star matches one or more values | '*' # same remark | 'list' type # this is a list where all elements have the same type (the argument) type : name | list | dict dict : 'dict' # a non-formal dict (keys and values are just strings) | 'dict' type type; # a formal dict : second and third types are the types of keys and values, resp. ====== The data structure is a 'list' as the syntax shows. ====== Data format examples: Structure: Data sample: ========== ============ * {a b {c d e}} {dict} {{opt value opt2 value2}} {{dict key {a b c}}} {{colors {red green blue} values {100 200 300}}} ====== ---- '''Javascript code:''' ====== var tclon = new Object(); tclon.tclon=function (input, types) { return tclon._tclon(tclon.parse(input), tclon.parse(types)); } tclon._tclon = function (input, types) { if (types.length == 0 || (types.length==1 && types[0]=="*")) return input; var res=new Array(), i, tab, elt; for (i=0; i