Shashank Shashank - 1 year ago 94
JSON Question

Print a string in JSON format in bash

I am using below statement in my CGI bash scrip, which is returning me error

[error] 1705#0: *105 upstream prematurely closed FastCGI stdout while reading response header from upstream [...]
. Is this a correct way to use it?

echo "{\"meta\": {\"link\": {\"upload\": { \"href\": \"http://${ip}${target}\"}}}, \"status\": \"empty\"}" | jq .

My expected output is as below.

"meta": {
"link": {
"upload": { "href": "{id}" }
},"status": "empty"

Answer Source

There was no configuration issue. The problem was caused because there was no response from the script for the POST request.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download