Take the 2-minute tour ×

For me usable means that:

  • it's being used in real-wold
  • it has tools support. (at least some simple editor)
  • it has human readable syntax (no angle brackets please)

Also I want it to be as close to XML as possible, i.e. there must be support for attributes as well as for properties. So, no YAML please. Currently, only one matching language comes to my mind - JSON. Do you know any other alternatives?

share|improve this question
JSON doesn't match. It doesn't support "attributes as well as properties". –  rjmunro Sep 24 '08 at 9:55
Get a pencil and paper, and try to mockup a syntax that supports attributes, elements and hierarchy. Now see how human readable your attempts are. –  Basel Shishani Jun 28 '13 at 5:59
add comment

12 Answers

up vote 32 down vote accepted

YAML is a 100% superset of JSON, so it doesn't make sense to reject YAML and then consider JSON instead. YAML does everything JSON does, but YAML gives so much more too (like references).

I can't think of anything XML can do that YAML can't, except to validate a document with a DTD, which in my experience has never been worth the overhead. But YAML is so much faster and easier to type and read than XML.

As for attributes or properties, if you think about it, they don't truly "add" anything... it's just a notational shortcut to write something as an attribute of the node instead of putting it in its own child node. But if you like that convenience, you can often emulate it with YAML's inline lists/hashes. Eg:

<!-- XML -->
<Director name="Spielberg">
        <Movie title="Jaws" year="1975"/>
        <Movie title="E.T." year="1982"/>

    name: Spielberg
      - Movie: {title: E.T., year: 1975}
      - Movie: {title: Jaws, year: 1982}

For me, the luxury of not having to write each node tag twice, combined with the freedom from all the angle-bracket litter makes YAML a preferred choice. I also actually like the lack of formal tag attributes, as that always seemed to me like a gray area of XML that needlessly introduced two sets of syntax (both when writing and traversing) for essentially the same concept. YAML does away with that confusion altogether.

share|improve this answer
Nice edit, Krish :D –  unkulunkulu Aug 7 '12 at 11:56
add comment

JSON is a very good alternative, and there are tools for it in multiple languages. And it's really easy to use in web clients, as it is native javascript.

share|improve this answer
I already mentioned JASON, do you know some alternative to it ? –  aku Sep 9 '08 at 10:01
add comment

I would recommend JSON ... but since you already mentioned it maybe you should take a look at Google protocol buffers.

Edit: Protocol buffers are made to be used programatically (there are bindings for c++, java, python ...) so they may not be suited for your purpose.

share|improve this answer
I've heard about Google protocol buffers but never bother to take a look at them. Did you have any experience with that Google stuff? –  aku Sep 9 '08 at 10:00
No practical experience. We use JSON at work but I had read the docs of Google's protocol buffers a bit and thought they might be worth it whenever JSON won't be suited enough. –  Pat Sep 9 '08 at 10:06
Protocol buffers have a very –  Ken Bloom Apr 4 '12 at 1:12
add comment

Jeff wrote about this here and here. That should help you get started.

share|improve this answer
add comment

You're demands are a bit impossible.. You want something close to XML, but reject probably the closest equivalent that doesn't have angle-bracket (YAML).

As much as I dislike it, why not just use XML? You shouldn't ever have to actually read XML (aside from debugging, I suppose), there are an absurd amount of tools about for it.

Pretty much anything that isn't XML isn't going to be as widely used, thus there will be less tool support.

JSON is probably about equivalent, but it's pretty much equally unreadable.. but again, you shouldn't ever have to actually read it (load it into whatever language you are using, and it should be transformed into native arrays/dicts/variables/whatever).

Oh, I do find JSON far nicer to parse than XML: I've used it in Javascript, and the simplejson Python module - about one command and it's nicely transformed into a native Python dict, or a Javascript object (thus the name!)

share|improve this answer
Please read my question carefully. YAML doesn't support attribute at all. –  aku Sep 9 '08 at 10:25
AFAIK, nor does JSON, but your question says that JSON is a valid alternative for your use. –  rjmunro Sep 24 '08 at 9:53
add comment

I think Clearsilver is a very good alternative. They even have a comparison page here and a list of projects that use it

share|improve this answer
looks interesting, thanks –  aku Sep 9 '08 at 10:04
add comment

I have found S-Expressions to be a great way to represent structured data. It's a very simple format which is easy to generate and parse. It doesn't support attributes, but like YAML & JSON, it doesn't need to. Attributes are simply a way for XML to limit verbosity. Simpler, cleaner formats just don't need them.

share|improve this answer
add comment

YAML is extremely fully-featured and generally human-readable format, but it's Achilles heal is complexity as demonstrated by the Rails vulnerabilities we saw this winter. Due to its ubiquity in Ruby as a config language Tom Preston-Werner of Github fame stepped up to create a sane alternative dubbed TOML. It gained massive traction immediately and has great tool support. I highly recommend anyone looking at YAML check it out:


share|improve this answer
add comment

If you're allergic to angle brackets, then JSON, HDF (ClearSilver), and OGDL are the only ones I know offhand.

After a bit of googling, I also found a list of alternatives here:

share|improve this answer
add comment

AFAIK, JSON and YAML are exactly equivalent in data structure terms. YAML just has less brackets and quotes and stuff. So I don't see how you are rejecting one and keeping the other.

Also, I don't see how XML's angle brackets are less "human readable" than JSON's square brackets, curly brackets and quotes.

share|improve this answer
As a person who wrote tons of those brackets, I can say there is a HUGE difference. You you don't know how YAML is different from XML, please read wikipedia articles linked in the question text. –  aku Sep 9 '08 at 11:01
I know how YAML and XML are different. What I don't know is how YAML and JSON are different, except that the former is more human readable, but you reject it, and the latter has square brackets, curly brackets and quotes, and you said it was OK. –  rjmunro Sep 24 '08 at 9:52
add comment

There are truly plenty of alternatives to XML, but the main problem with many of them seems to be that libraries might not be available for every language of choice and the libraries are relatively laborious to implement.

Parsing a tree structure itself might not be that pleasant, if compared to key-value pairs, e.g. hash tables. If a hash table instance meets the requirement that all of its keys are strings and all of its values are strings, then it's relatively non-laborous to implement hashtable2string() and string2hashtable().

I've been using the hash table serialization in AJAX between PHP and JavaScript and the format that I've developed, is called ProgFTE (Programmer Friendly text Exchange) and is described at:


One can find a Ruby version of the ProgFTE implementation as part of the Kibuvits Ruby Library: http://rubyforge.org/projects/kibuvits/

share|improve this answer
add comment

For storing code-like data, LES (Loyc Expression Syntax) is a budding alternative. I've noticed a lot of people use XML for code-like constructs, such as build systems which support conditionals, command invocations, sometimes even loops. These sorts of things look natural in LES:

// LES code has no built-in meaning. This just shows what it looks like.
    if version > 4.0 {
    } else {

It doesn't have great tool support yet, though; currently the only LES library is for C#. Currently only one app is known to use LES: LLLPG. It supports "attributes" but they are like C# attributes or Java annotations, not XML attributes.

In theory you could use LES for data or markup, but there are no standards for how to do that:

body {
    '''Click here to use the World's '''
    a href="http://google.com" {
        strong "most popular"; " search engine!"

point = (2, -3);
tasteMap = { "lemon" -> sour; "sugar" -> sweet; "grape" -> yummy };
share|improve this answer
add comment

Your Answer


