hosh icon indicating copy to clipboard operation
hosh copied to clipboard

CSV, JSON and XML support

Open dfa1 opened this issue 6 years ago • 3 comments

Problem Right now Hosh provides some very basic support for sorting, filtering, splitting, etc. Explore and experiment some new commands around data manipulation.

Solution Existing solutions of data manipulation of CSV, TSV, JSON are: https://github.com/johnkerl/miller https://github.com/stedolan/jq https://github.com/nushell/nushell

Benefit Be able to apply built-in commands like take drop select filter to produce/consume CSV/TSV/XML/JSON.

dfa1 avatar Nov 20 '19 07:11 dfa1

TSV and CSV could be covered by http://commons.apache.org/proper/commons-csv/ (a 44KB library with no additional dependencies).

JUnit5 is using https://github.com/uniVocity/univocity-parsers but jar file is quite big (400KB).

dfa1 avatar Nov 20 '19 10:11 dfa1

JSON could be covered by:

  • GSON 240KB, no additional dependencies
  • JSR 374 implementation is also needed (glassfish provides one)
  • joy another implementation for JSR 374

Please note that JSR 374 supports JsonPointer (https://tools.ietf.org/html/rfc6901).

dfa1 avatar Nov 20 '19 10:11 dfa1

XML could be covered without any additional dependency. Sample:

  • xpath file.xml expression | ..., to extract data from any document

dfa1 avatar Nov 20 '19 19:11 dfa1