I would like to convert a human-readable list such as this:
Enabled: No
Server: localhost
Port: 8888
Authenticated Proxy Enabled: 0
... into an object, preferably sanitized as JSON, such as this:
{
"Enabled": "No",
"Server": "localhost",
"Port": 8888,
"Authenticated Proxy Enabled": 0
}
But I don't want to be responsible for the code that does it.
I am working on a Node.js app which happens to make use of some built in networking tools on OS X via shelljs. This is where the list comes from and I simply need to process it.
Here is a command you can run from Terminal easily to see roughly what I see:
networksetup -getwebproxy Wi-Fi
Assuming you have a "network service" called Wi-Fi, that should spit out a list like the one above.
I would prefer numbers parsed as numbers, not strings. But I could live without that.
Please note: I am specifically looking to avoid re-inventing the wheel. Doing this myself would be relatively easy, but I want to delegate to a library for this mundane nuance of processing the data. I am asking to list projects which do this already.
This is a difficult problem to search for.
Aucun commentaire:
Enregistrer un commentaire