Jeremy Miller Jeremy Miller - 4 months ago 9
Javascript Question

How can I easily have a javascript function to parse out specific objects from json string

I would like to pull out each of these fields and put them into a their own variable in javascript

"did": "00022B9A000000010001",
"ps": -1,
"hostName": "",
"ipAddress": ""


You seem to want something very very plain ...

var jsonString = '{"did": "00022B9A000000010001","ps": -1,"hostName": "zs-","ipAddress": ""}';
var obj = JSON.parse(jsonString);

var did = obj.did;
var ps =;
var hostName = obj.hostName;
var ipAddress = obj.ipAddress;