I use jq to transform a complex json object into a tinier one. My query is:
jq 'to_entries[]| {companyId: (.key), companyTitle: (.value.title), companyCode: (.value.booking_service_code)}' companies.json
Now, the (.key)
is parsed as a string, yet I want companyId
to be a number.
My result currently looks like this:
{
"companyId": "1337",
"companyTitle": "Some company title",
"companyCode": "oxo"
}
yet it should be like:
{
"companyId": 1337,
"companyTitle": "Some company title",
"companyCode": "oxo"
}