[LRUG] On json and yaml

Gabe da Silveira gabe at websaviour.com
Tue Apr 29 08:49:41 PDT 2014


On Tue, Apr 29, 2014 at 4:36 PM, Graham Ashton <graham at effectif.com> wrote:

> I agree, but I’d definitely choose JSON. I think it’s less likely to
> change in an incompatible manner with the passage of time.
>
> I’ve been bitten by supposedly standard serialisation formats evolving in
> ways that break when read by updated code several times over the years (and
> one of those formats was Yaml, when a syntax change meant I had to use an
> old version of Ruby when releasing gems for the best part of a year).
>

Wise words these.  Taking a gander at the YAML spec ought to give any
software engineer serious pause.  It is an amazingly powerful language, but
I would only use it if all the above are true:

* The only code that needs to access it is ruby, YAML is not as well
supported and not as powerful with languages other than ruby
* I really need the rich features of YAML such as being able to serialize
ruby objects.
* I am never editing it by hand as there are terrible things that you will
never see coming, like, try running this in an irb and weep in horror:

YAML.load("  FI: Finland\n  NO: Norway\n  SE: Sweden")

JSON is well-defined, simple and relatively terse.  Use it if you can.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140429/983c1093/attachment-0003.html>


More information about the Chat mailing list