Expert Contributor
Posts: 362
Registered: ‎01-25-2017

Cloudera manager API json response as one line

[ Edited ]

Hi Guys,


I'm working to send the yarn applications meta data using the API to kibana,


But the API json response is pretty and kibana accepts the json as one line.


Below is one of the example i do, can anyone help me to know how to get this as one line?


curl -u 'xxxxx:'xxxxx' ''

Cloudera Employee
Posts: 293
Registered: ‎07-08-2013

Re: Cloudera manager API json response as one line

[ Edited ]

Workaround would be to parse it in python/bash(tr,awk,sed)/perl to remove the line breaks, an easier option is to use ./jq -c -- see [0]


curl -s -X GET -u xxxxx:xxxxx http://cm-server:7180/api/v11/.... | jq -c



--compact-output / -c:

By default, jq pretty-prints JSON output. 
Using this option will result in more compact output by
instead putting each JSON object on a single line.