i would like to know, if there is a way with javascript or typescript to
convert JSON to INI-Format. Im Newbie.
from:
{
"peerEndpoint": "blub.bla:49997",
"peerPublicKey": "dfasdfasfsdfasdfa",
"deviceIPs": [
"10.40.16.1"
],
"peerAllowedIPs": [
"10.40.16.0/22",
"10.40.0.0/20"
],
"applications": {}
}
to:
Address = 10.40.16.1/32
[Peer]
PublicKey = dfasdfasfsdfasdfa
Endpoint = blub.bla:49997
AllowedIPs = 10.40.16.0/22, 10.40.0.0/20
thank you so much in advance!
2
Answers
Of course. See below:
Explanation:
in case you use by any chance a node.js environment:
Than you could just install and use
and in your code you could use something like this:
If not I guess the approach from Lajos Arpad will do the trick.