JSON parser for Tcl built on-top of JSMN
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.
 
 
 
ICScaryThings a25606a5ef move version to makefile so it is in one place 5 months ago
LICENSE lic 5 months ago
Makefile move version to makefile so it is in one place 5 months ago
README.md readme 5 months ago
jsmn.h initial commit of jsmn based json parser for tcl 5 months ago
pkgIndex.tcl.in move version to makefile so it is in one place 5 months ago
tcljsmn.c move version to makefile so it is in one place 5 months ago
test.tcl update test 5 months ago
utf8_encode.h initial commit of jsmn based json parser for tcl 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}