Created 08-15-2017 08:00 AM
Hi all
How to convert blueprint json file to csv file?
My target is to convert all properties parameters to a csv file from the amabri cluster
Example – generate blueprint json file from my ambari cluster
curl -u admin:admin -H "X-Requested-By: ambari" -X GET http://10.23.4.122:8080/api/v1/clusters/HDP26?format=blueprint -o /tmp/HDP01_blueprint.json
example of expected results: ( all parameters from all config types should be in the csv file )
autopurge.purgeInterval,512
dataDir,/hadoop/zookeeper
autopurge.snapRetainCount,10
clientPort,2181
initLimit,11
tickTime,2000
syncLimit,5
Created 08-16-2017 03:13 PM
You can probably use a tool like jq to achieve this through a shell script:
https://stedolan.github.io/jq/
As to how to use jq, there is available literature on forums such as stackoverflow:
https://stackoverflow.com/questions/1955505/parsing-json-with-unix-tools
Created 08-16-2017 02:30 PM
What is your purpose in converting the JSON to a CSV? Perhaps we can find a better solution for you depending on what you're trying to accomplish.
Created 08-16-2017 03:13 PM
You can probably use a tool like jq to achieve this through a shell script:
https://stedolan.github.io/jq/
As to how to use jq, there is available literature on forums such as stackoverflow:
https://stackoverflow.com/questions/1955505/parsing-json-with-unix-tools
Created 08-17-2017 05:45 PM
yes , all I need is to know what is the config type for parameter ( so in the json file we have parameters ) but what I need to know by API is the config type for the parameter please help if you can
Created 08-17-2017 07:10 PM
Could you give me an example?
It sounds like you just want to be able to read the values for a property inside of the JSON file - could you explain why specifically you need it in a CSV format? For nested data like this it is usually better to have it in a JSON format.