Embedded Parser Memory Use XML vs JSON vs?
I have an embedded weberver which is currently used to administer various bits of hardware over a network.
Currently it has a browser type web interface, but I need to enhance it to provide a REST API so that its functions can be automated and the obvious choice would be to use XML or JSON.
The device only has 8MB of RAM and 4MB of flash so code size and memory usage are critical.
The obvious choices are JSON and XML for the interface and I would be interested to know which you think would be the most efficient approach (or something else) and best library. (It's coded in C)
An additional constraint I should mention is that whatever I spec I will be documenting and providing to customers to build against so human readable is better.
This is the JSON library I've been looking at: http://zserge.bitbucket.org/jsmn.html
and this is the XML: http://expat.sourceforge.net/
JSON is generally more light weight and efficient than xml (e.g. less rules, less corner cases, shorter data, more similar to actual datatypes, ...)
Or if you want it to be really efficient, you could uses a binary format like BSON.