Select, put and delete data from JSON, TOML, YAML, XML and CSV files
21–30 of 34 posts
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#22Earlier quoted context omitted.
Of course you can do it with http://brackit.io . What exactly is the "transformation" you envision?
Something like this (very simplified): let $array := [{"foo":0,"bar":"tztz"},{"foo":"hello","bar":null},{"foo":true,"bar":"yes"}] let $value := for $object in $array return let $fields := bit:fields($object) let $len := bit:len($fields) for $field at $pos in $fields return if ($pos $field || "," ) else ( $object=>$field || "\n" ) return string-join($value,"") will output: 0,tztz hello,null true,yes
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#23Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#24That's a fascinating concept. Is there anything similar for INI? Such a tool for ini could help in automatically changing configuration files for software which is most often configured by ini files.
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#25Can this or anything else flatten arrays of JSON objects to CSV?
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#26Earlier quoted context omitted.
Something like this (very simplified): let $array := [{"foo":0,"bar":"tztz"},{"foo":"hello","bar":null},{"foo":true,"bar":"yes"}] let $value := for $object in $array return let $fields := bit:fields($object) let $len := bit:len($fields) for $field at $pos in $fields return if ($pos $field || "," ) else ( $object=>$field || "\n" ) return string-join($value,"") will output: 0,tztz hello,null true,yes
You could do something like this in pure python without the json loading boilerplate with jello[0]. An interactive TUI for jello called jellex[1} is also available. (I am the author) [0] https://github.com/kellyjonbrazil/jello [1] https://github.com/kellyjonbrazil/jellex
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#27Reminds me of https://github.com/johnkerl/miller which is also a go based tool cloning features from tools like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON
Also IMHO modules with user-defined (higher order?) functions are a big plus of a query language.
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#28Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#29That's a fascinating concept. Is there anything similar for INI? Such a tool for ini could help in automatically changing configuration files for software which is most often configured by ini files.
1: https://augeas.net/docs/references/1.4.0/lenses/files/inifil...
Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files
#30Can this or anything else flatten arrays of JSON objects to CSV?
Pypi: https://pypi.org/project/flattentool/
Docs: https://flatten-tool.readthedocs.io/en/latest/
It's maintained by Open Data Services Coop, where we use it as a component in several of our web & data pipeline tools for working with data that is published in a Data Standard.