Hi,

Peter Eisentraut <pete...@gmx.net> writes:
> I was actually looking for a C library for JSON (json type for PostgreSQL; 
> you 
> know it is coming :-) ), but only found a library tied to glib, which, 
> considering the experience with libxml, did not excite me.  If someone knows 
> of a different, small, and independent JSON library for C, I would like to 
> hear about it.

Looking at http://json.org/, it seems this particular project could fit:

  http://lloyd.github.com/yajl/

  Yet Another JSON Library. YAJL is a small event-driven (SAX-style)
  JSON parser written in ANSI C, and a small validating JSON
  generator. YAJL is released under the BSD license.

  ...

  It's all ANSI C. It's been successfully compiled on debian linux, OSX
  10.4 i386 & ppc, OSX 10.5 i386, winXP, FreeBSD 4.10, FreeBSD 6.1
  amd64, FreeBSD 7 i386, and windows vista. More platforms and binaries
  as time permits. 

  ...

  A second motivation for writing YAJL, was that many available free
  JSON parsers fall over on large or complex inputs. YAJL is careful to
  minimize memory copying and input re-scanning when possible. The
  result is a parser that should be fast enough for most applications or
  tunable for any application. On my mac pro (2.66 ghz) it takes 1s to
  verify a 60meg json file. Minimizing that same file with json_reformat
  takes 4s. 

  Largely because YAJL deals with streams, it's possible to parse JSON
  in low memory environments. Oftentimes with other parsers an
  application must hold both the input text and the memory
  representation of the tree in memory at one time. With YAJL you can
  incrementally read the input stream and hold only the in memory
  representation. Or for filtering or validation tasks, it's not
  required to hold the entire input text in memory. 


Hope this helps, regards,
-- 
dim

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to