Shashank Shashank - 2 months ago 28
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"


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