[LRUG] On json and yaml

Rory Sinclair rory at asmallworld.net
Tue Apr 29 08:28:04 PDT 2014


Agree with Sasha’s summary.  With regards ‘issues in interpretation when its parsed’, I think the key thing is to never modify yaml or json files by hand - always use the tooling to generate and write the files, even for simple modifications.  I’d say this goes for CSV too (non-obvious handling of commas in value data).

So, provided you use Ruby to actually generate, write and then read the yaml or json or <insert format> files, and provided those formats have rules to handle escaping / encoding problematic content, you should be fine.

HTH

Regards  

--  
Rory Sinclair
Head of Technology
ASMALLWORLD


On Tuesday, 29 April 2014 at 14:48, Sasha Gerrand wrote:

> On 29 April 2014 08:25, MG Lim <mirageglobe at gmail.com (mailto:mirageglobe at gmail.com)> wrote:
> > I am building an automated bash script in ruby. Just wondering if anyone has pointers for using either json or yaml as store for this.
> >  
> > for example....  
> >  
> > yaml
> >  
> > list:
> >   script a:  
> >     - clear
> >  
> > or  
> > json
> >  
> > {
> >   "script": "clear"
> > }  
> >  
> > Contents are all bash scripts with labels. My key concern is if there are issues in interpretation when its parsed.
> It appears like you are building script runner which uses a hash for the execution information, with the scripts to be executed as the keys and the values/options being passed to the script as values or nested arrays of values. I wouldn't see any major issues with using JSON or YAML as the storage format, however there may be requirements for this runner which haven't been detailed yet.  
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org (mailto:Chat at lists.lrug.org)
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140429/e2988879/attachment-0003.html>


More information about the Chat mailing list