Categories
Mastering Development

How to remove quotes for json keys in json string using regex in jq

Trying to convert json payload to graphql and having some troubles. I need to convert string like "{ \"entity\":{ \"id\":\"7fbe7e65-0f01-4934-a2a9-dcc6d81a5b95\", \"type\":\"Products\", \"status\":\"pending\", \"services\":[ { \"id\":\"1e05737e-754b-4d19-b872-5a0135d99cf4\", \"type\":\"Services\", \"status\":\"active\" },{ \"id\":\"2238fe75-3d1a-4768-8464-be7d48037215\", \"type\":\"Services\", \"status\":\"active\" } ] } }" to string where no quotes for keys: "{ entity:{ id:\"7fbe7e65-0f01-4934-a2a9-dcc6d81a5b95\", type:\"Products\", status:\"pending\", services:[ { id:\"1e05737e-754b-4d19-b872-5a0135d99cf4\", type:\"Services\", status:\"active\" },{ id:\"2238fe75-3d1a-4768-8464-be7d48037215\", type:\"Services\", […]