Skip to content
Owen Swerkstrom edited this page Mar 1, 2024 · 35 revisions

================================== WJElement - JSON manipulation in C

WJElement is a very flexible JSON library developed by Netmail (aka Messaging Architects). It was created for our "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.
    • WJElement provides JSON-schema validation (draft v3 is fully supported; v4 support is working but incomplete).

License

WJElement and its related libraries may be consumed in any project, open or closed, as outlined by your choice of licenses:

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! :^)

Several people have asked about a static library exception for the sake of using WJElement on platforms where the use of user-modified libraries is problematic. In those cases, we'd appreciate a mention/link in the credits, but go ahead. You may also be interested in redistributing WJE under an older LGPL version, or the Expat/MIT license.

API

You may also want to check out a quick WJElement Example to see how WJElement accomplishes JavaScript-like data manipulation in C.

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, there are a few things to note about this library...

  • XplBool return values
    • Many functions return TRUE on success. Deal. :^)
  • JSON-Schema version
    • The implemented draft 3 is now outdated, but will continue to be available (probably a build option) in WJE if and when support is added for newer versions.
  • Schema "backlink"
    • 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 wraps malloc et al.

You are free and encouraged to add and contribute features if you are so inclined. WJElement is great, but you can make it even better!

Contact

  • Owen Swerkstrom <[email protected]> - community/repository admin, WJElementSchema author
  • Micah N Gorrell - primary WJElement, WJReader, WJWriter author