Debian Codegraph @

yajl/README

raw
1 **********************************************************************
2 This is YAJL 2. For the legacy version of YAJL see
3 https://github.com/lloyd/yajl/tree/1.x
4 **********************************************************************
5
6 Welcome to Yet Another JSON Library (YAJL)
7
8 ## Why does the world need another C library for parsing JSON?
9
10 Good question. In a review of current C JSON parsing libraries I was
11 unable to find one that satisfies my requirements. Those are,
12 0. written in C
13 1. portable
14 2. robust -- as close to "crash proof" as possible
15 3. data representation independent
16 4. fast
17 5. generates verbose, useful error messages including context of where
18 the error occurs in the input text.
19 6. can parse JSON data off a stream, incrementally
20 7. simple to use
21 8. tiny
22
23 Numbers 3, 5, 6, and 7 were particularly hard to find, and were what
24 caused me to ultimately create YAJL. This document is a tour of some
25 of the more important aspects of YAJL.
26
27 ## YAJL is Free.
28
29 Permissive licensing means you can use it in open source and
30 commercial products alike without any fees. My request beyond the
31 licensing is that if you find bugs drop me a email, or better yet,
32 fork and fix.
33
34 Porting YAJL should be trivial, the implementation is ANSI C. If you
35 port to new systems I'd love to hear of it and integrate your patches.
36
37 ## YAJL is data representation independent.
38
39 BYODR! Many JSON libraries impose a structure based data representation
40 on you. This is a benefit in some cases and a drawback in others.
41 YAJL uses callbacks to remain agnostic of the in-memory representation.
42 So if you wish to build up an in-memory representation, you may do so
43 using YAJL, but you must bring the code that defines and populates the
44 in memory structure.
45
46 This also means that YAJL can be used by other (higher level) JSON
47 libraries if so desired.
48
49 ## YAJL supports stream parsing
50
51 This means you do not need to hold the whole JSON representation in
52 textual form in memory. This makes YAJL ideal for filtering projects,
53 where you're converting YAJL from one form to another (i.e. XML). The
54 included JSON pretty printer is an example of such a filter program.
55
56 ## YAJL is fast
57
58 Minimal memory copying is performed. YAJL, when possible, returns
59 pointers into the client provided text (i.e. for strings that have no
60 embedded escape chars, hopefully the common case). I've put a lot of
61 effort into profiling and tuning performance, but I have ignored a
62 couple possible performance improvements to keep the interface clean,
63 small, and flexible. My hope is that YAJL will perform comparably to
64 the fastest JSON parser out there.
65
66 YAJL should impose both minimal CPU and memory requirements on your
67 application.
68
69 ## YAJL is tiny.
70
71 Fat free. No whip.
72
73 enjoy,
74 Lloyd - July, 2007