<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Rick and I got into a discussion of these three different markup formats over the last few days (due to my post on the list mentioning it, and I thought I’d mention something I’d learned recently.<div class=""><br class=""></div><div class="">I was at Silicon Valley Code Camp and went to this talk on the history of JSON: <a href="https://www.youtube.com/watch?v=xZdNGfFh5BY" class="">https://www.youtube.com/watch?v=xZdNGfFh5BY</a></div><div class=""><br class=""></div><div class="">Douglas Crockford, the JSON codifier, pointed out that XML had essentially vanished in all but legacy enterprise applications. And it’s true, I haven’t seen it mentioned on job listings in years. Only JSON.</div><div class=""><br class=""></div><div class="">In terms of simplicity, YAML > JSON > XML.</div><div class=""><br class=""></div><div class="">What’s interesting is that, despite YAML being a simpler format, as of YAML 1.2, all JSON files are also YAML-compliant. (The reverse is not true.)</div><div class=""><br class=""></div><div class="">I got introduced to YAML with Ruby on Rails and got really into it. You could specify test data like:</div><div class=""><br class=""></div><div class=""><div class="">uno:</div><div class=""> id: 1</div><div class=""> name: Forest Keeper</div><div class=""> speed: 88</div><div class="">dos:</div><div class=""> id: 2</div><div class=""> name: Ghost</div><div class=""> speed: 101</div><div class="">tres:</div><div class=""> id: 3</div><div class=""> name: Horned Frog</div><div class=""> speed: 100</div></div><div class=""><br class=""></div><div class="">(Note that YAML uses whitespace and indentation as syntactically significant. The names of each record are only used for test purposes and not stored in the db.)</div><div class=""><br class=""></div><div class="">In JSON, this would be:</div><div class=""><br class=""></div><div class=""><div class="">{"monsters":[</div><div class=""> {"id": 1,</div><div class=""> "name": "Forest Keeper",</div><div class=""> "speed": 88},</div><div class=""> {"id": 2,</div><div class=""> "name": "Ghost",</div><div class=""> "speed": 101},</div><div class=""> {"id": 3,</div><div class=""> "name": "Horned Frog",</div><div class=""> "speed": 100}</div><div class="">]}</div></div><div class=""><br class=""></div><div class="">Too much shifting and unshifting for those quotes and braces, imho, but usable enough.</div><div class=""><br class=""></div><div class="">XML would be even more verbose and I’m not even gonna go there. It’s a new decade after all.</div><div class=""><br class=""></div><div class="">Deirdre</div><div class=""><br class=""></div></body></html>