Quantcast
Viewing all articles
Browse latest Browse all 524

Unable to form JQ as per requirement

I am using JQ Play.

Here is my JSON Data -

{"body":{"primarykey": ["book_id","edition_id"],"members": [    {"name": "book_id","type": "NUMBER"    },    {"name": "edition_id","type": "NUMBER"    },    {"name": "title","type": "VARCHAR2"    }],"links": [    {"rel": "collection","href": "https://tdcvm28s16.bcone.com:7002/ords/testords/metadata-catalog/","mediaType": "application/json"    },    {"rel": "canonical","href": "https://tdcvm28s16.bcone.com:7002/ords/testords/metadata-catalog/books/","mediaType": "application/json"    },    {"rel": "alternate","href": "https://tdcvm28s16.bcone.com:7002/ords/testords/open-api-catalog/books/","mediaType": "application/openapi+json"    },    {"rel": "describes","href": "https://tdcvm28s16.bcone.com:7002/ords/testords/books/"    }]}}

My JQ -

.body.primarykey[] | "{" + . +"}"

Current Output -

"{book_id}""{edition_id}"

My expected output is -

{"book_id"},{"edition_id"}

Here if there are more primary keys, they should also get appended in expected output.

Please help me with correct JQ that will work in jqplay.org


Viewing all articles
Browse latest Browse all 524

Trending Articles