Live data from Hacker News

Select, put and delete data from JSON, TOML, YAML, XML and CSV files

github.com

21–30 of 34 posts

Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files

#22

Earlier 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

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

#24
post #23

That'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.

Not a generic tool as such, but Winter CMS has a INI parser / renderer built into the core: https://wintercms.com/docs/services/parser#ini-parser

Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files

#25

Can this or anything else flatten arrays of JSON objects to CSV?

I mostly go from csv to csv but nushell handles table data in files really well [1]. I've done a little but of json manipulation with it but not a ton, so I can't say it's a silver bullet.

1. https://www.nushell.sh/book/

Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files

#26
post #22

Earlier 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

JSON loading boilerplate? Is it also a compiler with sophisticated optimizations during compile time? :)

Re: Select, put and delete data from JSON, TOML, YAML, XML and CSV files

#27

Reminds 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

It is nice, but I wonder if it's also a full-fledged query compiler?

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

#29
post #23

That'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.

I haven't used it but augeas seems to have support for ini files [1].

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

#30

Can this or anything else flatten arrays of JSON objects to CSV?

Here's a Python library with a CLI:

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.

Post reply on HN