Skip to content

Instantly share code, notes, and snippets.

@thomaslarsen
Last active October 25, 2024 18:08
Show Gist options
  • Save thomaslarsen/bc742bcd958896458d8006bdadf7d102 to your computer and use it in GitHub Desktop.
Save thomaslarsen/bc742bcd958896458d8006bdadf7d102 to your computer and use it in GitHub Desktop.
Convert PEM certificate to JSON format
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' cert-name.pem
@ldnicolasmay
Copy link

If you need a more modern version of this you can use jq to do all sorts of magic with JSON. In any case you could run jq -sR . $any_file to convert the entire file to JSON.

Sorry, just happened to stumble on this and thought jq might help someone.

Yep... jq definitely comes in handy for this. Thanks @benaryorg!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment