I know how to echo / add text to the end of a file:
echo "{ "fruit":"apple" , "amount":"10" }" >> file.txt
My question is how to add a object to the json file below:
the file - file.txt (empty):
{
"fruit": [
]
}
Expected result:
{
"fruit": [
{ "fruit":"apple" , "amount":"10" } #object to add
]
}
bashfor that, but use a real JSON library.