regex - Removing entry from json -
i'm looking remove "registrationcertificates" entry json file using bash command
{ "hardwareprivatekey": "-----begin rsa private key-----\1234 "destinations": [ { "destination": "test.com", "destinationip": "1.1.1.1", "registrationprivatekey": "-----begin rsa private key-----\nm "registrationpublickey": "-----begin rsa public key-----\nmi "hardwarecertificates": [ "certificate": "-----begin certificate-----\nm "certificate": "-----begin certificate-----\nmiid ], "registrationcertificates": [ "certificate": "-----begin certificate-----\nmiid "certificate": "-----begin certificate-----\nmiid0 ] } ] } crc=8
your json isn't valid never work but......
i suggest install jq package. it's command line tool work json in bash.
you use jq delete key so:
jq 'map(del (.keytoremove) | del (.secondkeytoremove))' enjoy!
Comments
Post a Comment