A simple filter to convert the nodes on the network map to a CSV file
(TOC generated by markdown-toc)
This project requires jq for JSON parsing. See jq's installation instructions, the link is in the References section.
Please have it installed first.
To convert a JSON file with the node information produced by the Network Map, run the node-infos-to-csv script
./node-infos-to-csv path-to-the-node-infos.json
This script reads a JSON file with node information, as produced by the Network Map, and converts it to a comma separated values (CSV) file. It reads that file either from its input, thus making it suitable to use as a filter, or reads the content from its first parameter.
So:
./node-infos-to-csv path-to-the-node-infos.json
and
cat path-to-the-node-infos.json | ./node-infos-to-csv
would work the same. Specifically, it will work with a tool like curl
, for example:
curl -q https://[compatibilityZoneURL]/network-map/json/node-infos | ./node-infos-to-csv >node-infos.csv
To adapt the data format used by the Network Map, the following changes are made:
Legal Indentities
array is flatten into a string, and entries are merged with a semicolon (;
)Addresses
array is flatten into a string as follows:host
andport
are merged with a double colon (:
)host:port
are merged with a comma (,
)
- jq - see the official documentation and the installation instructions