I am just trying with this basic line, but I am not getting, here is the command.
echo {“x”:1} | jq '[ . ]'
It is showing the error as follows.
parse error: Invalid numeric literal at line 1, column 9
The expected output is :
[{"x":1}]
“ and ” are invalid quoting chars, the valid quoting char is ".
The second moment is that the echo command arguments should be enclosed in single or double quotes (in conformity with argument content) to present a literal string:
echo '{"x":1}{"y":1}' | jq -s '.'
[
{
"x": 1
},
{
"y": 1
}
]
-s option: echo '{"x":1}{"y":1}' | jq -s '.'
“- is invalid quoting char