You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
5 months ago | |
---|---|---|
LICENSE | 5 months ago | |
Makefile | 5 months ago | |
README.md | 5 months ago | |
jsmn.h | 5 months ago | |
pkgIndex.tcl.in | 5 months ago | |
tcljsmn.c | 5 months ago | |
test.tcl | 5 months ago | |
utf8_encode.h | 5 months ago |
README.md
Overview
This is a JSON parser package for Tcl built using jsmn: a minimalist C header
only JSON parser. Unlike jsmn on it's own which just spits out a series of tokens,
this parser does actually convert the JSON to nested Tcl dict and list structures
and replaces any \
escapes in strings like a normal parser to make them easy
to use from Tcl.
Building
To build just run make
and install with make install prefix=/usr/lib/tclVERSIONHERE
Requirements
- Tcl development headers (usually included with a normal Tcl install)
- C>=99 Compiler
Using
If you install it into your tcl lib directory you can load it with package require jsmn
or you can put it anywhere and add it to your path lappend ::auto_path /my/path/here
.
Example
Usage:
package require jsmn
set d [jsmn::parse {{"a": 123, "b": 456, "c": [1, 2, 3]}}]
puts [dict keys $d]
puts [dict values $d]
Output:
a b c
123 456 {1 2 3}