Category: JSON
-
the Bitwarden command-line tool
- https://bitwarden.com/help/article/cli/
- https://stedolan.github.io/jq/ – “bw” (the CLI utility) works well with jq
-
extracting fields from a Jira “issue” (like a very nice and useful description)? how to get the markup source of the issue description?
No, Jira does not let you read (“per se“) the markup source of an “issue” – that’s why I went this way in the first place 🙄
- http://Jochen.Hayek.name/wp/blog-en/2015/12/02/jira-rest-api/ – using Jira’s REST API: a “…/rest/api/2/issue/…” URL
- http://Jochen.Hayek.name/wp/blog-en/2015/12/22/jq-json-processor/ – how to use
jqfor json-tidying
jq . X.json > X.pretty.json
- http://Jochen.Hayek.name/wp/blog-en/2018/01/17/json-extract-structure/ – extract the structure tree of your JSON data using
jqand a nice command line
jq -c 'path(..)|[.[]|tostring]|join("/")|"."+.' X.pretty.json- the field we are interested in is
fields/description
jq ".fields.description" X.json > X.description.txt
- save the value of that field to a separate file!
- remove the leading and trailing double-quotes!
- replace all
\"with ordinary double-quotes! - remove
\r! - replace
\nwith ordinary new-lines!
jq ".fields.description" X.json | perl -pe 's/^"(.*)"$/$1/; s/\\"/"/g; s/\\r//g; s/\\n/\n/g' > X.description.txt
- …
- looks good, doesn’t it?
-
another nice JSON file: how to extract its structure using jq
$ jq -c 'path(..)|[.[]|tostring]|join("/")|"."+.'The idea is to use one of the output lines in order to access the respective field on your next
jqcommand line:$ jq ".fields.description" X.json
-
file extension NSX – Synology DiskStation Manager exported note
- http://www.file-extensions.org/nsx-file-extension-synology-diskstation-manager-exported-note
- actually a .zip file containing JSON files – I format them nicely through jq:
- https://stedolan.github.io/jq/
- the JSON comes with attributes ctime and mtime in seconds, “that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds“:
- https://en.wikipedia.org/wiki/Unix_time – AKA POSIX time or Epoch time
- as the JSON syntax does not allow for comments, and I still want to have readable ctime and mtime, I am adding attributes “readable-ctime” and “readable-mtime”, with values created by “date ‘+%F %T’ –date=@SECONDS“
-
no comments in JSON – but …
But why don’t you add a new name/value pair, the “value” being the comment, the “name” being a name for that comment, make it rather short, if that fits in your context.
-
Xidel – yet another HTML/XML/JSON data extraction tool
Xidel is a command line tool to download html/xml pages and extract data from them using CSS 3 selectors, XPath 3 expressions or pattern-matching templates.
- http://www.videlibri.de/xidel.html
- https://en.wikipedia.org/wiki/XQuery – I am “watching” the changes on this article, and somebody just added Xidel, that’s how I came across Xidel
- Cygwin’s and Fink’s repository do not have Xidel, but Xidel’s home page (see above!) points you to its download area on sourceforge, where you can find binaries for all the relevant platforms
I wonder, whether I can use it just like xmlstarlet.
-
O’Reilly Media book: JSON at Work – Practical Data Integration for the Web
- http://shop.oreilly.com/product/0636920028482.do
- https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/
- https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/#toc
- https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/ch05.html#json_schema
- https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/ch06.html#json_search : …,
jq,jqPlay,jq-tutorial, … - https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/ch07.html#json_transform
- https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/ch09.html#json_and_mongodb
- https://www.safaribooksonline.com/library/view/json-at-work/9781491982389/ch10.html#json_messaging_with_kafka
More than just a simple replacement for XML when you make an AJAX call, JSON is becoming the backbone of any serious data interchange over the Internet. This practical book shows web architects and developers how to harness the energy and enthusiasm around JSON to build truly elegant, useful, and efficient applications. It’s complete with examples in JavaScript, jQuery, HTML5, Ruby, and Java.