This snippet will convert a PEM based certificate of key to JSON format. This is useful when having to embed a certificate in a JSON object.
It will simply add \n
in the required places.
The snipped was copied from here: https://docs.vmware.com/en/Unified-Access-Gateway/2.9/com.vmware.access-point-29-deploy-config/GUID-870AF51F-AB37-4D6C-B9F5-4BFEB18F11E9.html
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.