Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

unable to create array using jq

I have been trying to create a JSON file using jq. For single argument, it works good

bash$ jq -n --arg capital delhi --arg noofstates 29 '{"india":"\($capital)","states":"\($noofstates)"}'
{
  "states": "29",
  "india": "delhi"
}

Now, I need to expand this json with array via jq. For e.x

"statelanguage": [{
                                                "Tamilnadu": "Tamil",
                                                "Statenumber": "22"
                                },
                                {
                                                "Andra": "Telugu",
                                                "Statenumber: "8"
                                }
                ],

I am not able to figure out how to do this via jq

Comments