mercredi 4 février 2015

How do I parse text into a JSON object?


I have a dhcp lease file with the following example entries:



lease 172.16.20.11 { starts 4 2014/10/09 18:33:57; ends 4 2014/10/09 18:43:57; cltt 4 2014/10/09 18:33:57; binding state active; next binding state free; rewind binding state free; hardware ethernet XX:XX:XX:XX:XX:XX; client-hostname "phone"; }



I am trying to find a way to convert the information into JSON so I can use in Dojo.


I would like the output to be like



{"leases": ["address":"172.16.20.11", "starts":"2014/10/09 18:33:57", "ends":"2014/10/09 18:43:57","
client-hostname":"phone"]}


Is there a way to do this?


Thanks, Tim T





Aucun commentaire:

Enregistrer un commentaire