Skip to content
penduin edited this page Aug 17, 2012 · 35 revisions

WJElement - JSON manipulation in C

WJElement is a very flexible JSON library developed by Messaging Architects. It was created for MA's "WARP" webserver, and is built on top of the (also- included) lower-level WJReader and WJWriter libraries.

  • WJReader and WJWriter are optimized for speed and memory-efficiency.
  • WJElement focuses on flexibility and handy features, allowing C code to manipulate JSON documents with as few statements (fewer, sometimes!) as JavaScript itself.

License

WJElement and its related libraries may be consumed in any project, open or closed, as outlined by the GNU Lesser General Public License. Include it as-is and link to it from your code, massage it into your own statically-linked package, or use it in ways we haven't thought of. Read the docs/headers, have fun, and if you use it for something awesome, let us know about it! :^)

API

  • WJElement - flexible JSON manipulation
  • WJReader - lightweight JSON reader
  • WJWriter - lightweight JSON writer

Quirks

In the spirit of being upfront, and to help you guage whether WJElement is right for you without asking you to invest too much time, it should be noted that there are a few things this library currently does not do, or in a generally-useful fashion, or handles in a seemingly-awkward way...

  • XplBool return values
    • Many functions return TRUE on success. Deal. :^)
  • Floating-point number values (unimplemented)
    • WJElement does not support floats, because we don't need them, at least not yet.
  • Schema validation (useful, incomplete)
    • "patternProperties" validation is unimplemented; JSON with invalid data in such a defined property will pass.
    • "format" validation on strings is unimplemented. The json-schema draft specification allows this to be missing, and so far, so do we.
    • "backlinks"... This is something we're making use of in netmail, but is not part of the base json-schema spec. You can safely ignore it (or dig in and use it, why not? :^)
  • Libraries, headers (stubs and #define's)
    • Xpl (cross-platform library) provides a consistent set of utility functions within netmail. WJElement uses a subset of these functions and definitions, so they have been included.
    • MemMgr (memory manager) provides optimized, slab-based memory management in netmail; for the sake of a general WJElement release, the MemMgr API simply calls malloc et al.

You are free and encouraged to add (and contribute back ;^) these features if you are so inclined. In most cases, there are comments or even empty code blocks, just waiting to be filled in. WJElement is great, but you can make it even better!

Contact

  • Owen Swerkstrom [email protected] - community/repository front-man, primary WJElementSchema author
  • Micah N Gorrell [email protected] - primary WJElement, WJReader, WJWriter author
Clone this wiki locally