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.

Need Your Help

Functions within a loop using requirejs

javascript jquery ajax requirejs

I'm having an issue with calling functions within a loop across different modules using requirejs. The function call within the loop resides in module A and executes a function in module B that fir...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.