Followers 0

# Alternative to JSON and XML?

## 30 posts in this topic

But is richness a good thing in most use-cases? The main reason I advocate YAML over XML is it's simplicity - if you don't need schema validation, XPath, XSLT, or any of the other fancy addons to XML, it's just so much added cruft.

Exactly. Simplicity is key here. I'd use INI files if I didn't need to store other types of data than just simple values.

0

##### Share on other sites

Pretty much this. Until recently I used Lua for this kind of thing extensively, but unless you like writing lots of tedious stack calling to get your data, you have to code an extra interface layer to allow Lua to build and populate your objects directly. Thanks to swiftcoder in this thread, I started using yaml-cpp and I have to say I'm a fan. Building a YAML node manually or reading data from a node are dead simple using the "new" interface, and structurally my data is very similar to a Lua table, as long as I only need data and not Lua functions-as-data.

Note that the yaml-cpp stable build is for the "old" interface which is apparently much clunkier; grab the latest build from the repository which supports syntax such as

node["x_resolution"]=1280
and
bool fullscreen=node["fullscreen"].as<bool>();
so streaming data in an out is a breeze.

Oh nice!! The old interface is what I tried last, and it certainly wasn't very friendly (and liked to spit out lots of compiler warnings). I'll have to give the new one a try, that interface looks great.

I'm always wary of downloading work-in-progress snapshots of code from a repository. Any issues that you've seen so far?

0

##### Share on other sites
But is richness a good thing in most use-cases? The main reason I advocate YAML over XML is it's simplicity - if you don't need schema validation, XPath, XSLT, or any of the other fancy addons to XML, it's just so much added cruft.

Exactly. Simplicity is key here. I'd use INI files if I didn't need to store other types of data than just simple values.

https://github.com/edn-format/edn is simple because it allows several data structures (lists, maps, sets), so no overloading or other wierdness is going on.

0

##### Share on other sites

[quote name='Nairou' timestamp='1356705245' post='5015075']
Oh nice!! The old interface is what I tried last, and it certainly wasn't very friendly (and liked to spit out lots of compiler warnings). I'll have to give the new one a try, that interface looks great.

I'm always wary of downloading work-in-progress snapshots of code from a repository. Any issues that you've seen so far?
[/quote]

So far, I haven't run into any troubles. It seems pretty stable.

0

##### Share on other sites

Have a look at my proposal:

http://stobml.org

It is very simple and is not overloadad with variety of special symbols, just {} and "" basically.

There is a library in C++.

0

0