v2.5.1
With an option -t <json/yaml/xml>
, opy reads contents of a file as json/yaml/xml data and sets it to an object "T".
examples:
$ echo '{"hoge":["a","b"]}' | opy -t json '[*T["hoge"]]'
a
b
$ echo -e 'aho:\n boke: ["a","b"]' | opy -t yaml '[*T["aho"]["boke"]]'
a
b
$ echo -e '<?xml version="1.0" encoding="utf-8"?>\n<foo>bar</foo>' | opy -t xml '[e.text for e in T.iter("foo")]'
bar