parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

--json and --xml


From: Ole Tange
Subject: --json and --xml
Date: Sun, 10 Aug 2014 03:06:24 +0200

GNU Parallel has supported tsv (tab separated values) for a long time.

A couple of years ago I was asked to make GNU Parallel parse JSON
elements. At that time it would have been a major task. With the --rpl
and {= perlexpression =} infrastructure I think it is doable.

And if we are looking at JSON, we might look at XML as well. XML has
XPath to address elements. So I imagine that you somehow tell where a
new record starts (maybe using --recend --recstart?) and then use
XPath to tell which elements to loop over - similar to {1} {2}  and
named columns for tsv:

cat foo.xml | paralllel --xml echo
'{//draw:frame[@svg:width="28.2cm"]/draw:image/@xlink:href}'

Does JSON have a similar standardized way of addressing? JSONPath?
http://goessner.net/articles/JsonPath/

cat books.json | parallel --json echo '{$..book[-1:].author}'

I have never worked heavily with neither JSON nor XML, so I would like
some input on how you would like to see the syntax. Especially if
there already is a standardized way (such as XPath) that we can use.

I imagine some of you use GNU Parallel on both JSON files and XML
files, and you pre-process them before feeding them to GNU Parallel.
How should GNU Parallel work, so your pre-processing becomes
unnecessary?


/Ole



reply via email to

[Prev in Thread] Current Thread [Next in Thread]