Might be easy enough for someone who has experience with jq. I am novice. I am learning jq with bash to create json arrays. I want to generate json array with jq in bash.
I have my file named fileForV:
V Apple is good for you
A Broccoli is good for you
Note: The space is a tab.
I have:
jq -R '[inputs |
split("\t") |
{"FruitOrVeg":.[0],"Good?":.[1]}]'<<EOF fileForV EOF
I get:
[
{
"FruitOrVeg": "A",
"Good?": "Apple is good for you"
},
{
"FruitOrVeg": "V",
"Good?": "Broccoli is good for you\""
}
]
Why do I get \"" at the end?
Should be:
[
{
"FruitOrVeg": "A",
"Good?": "Apple is good for you"
},
{
"FruitOrVeg": "V",
"Good?": "Broccoli is good for you"
}
]