README 2.7 KB

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