javascript says JSON object property is undefined although it's not

Looks like your json object is not really an object, it's a json string. in order to use it as an object you will need to use a deserialization function like JSON.parse(obj). Many frameworks have their own implementation to how to deserialize a JSON string.
When you try to do alert(obj) with a real object the result would be [object Object] or something like that


Your JSON is not parsed, so in order for JavaScript to be able to access it's values you should parse it first as in line 1:

var result = JSON.parse(object);
alert(result.id);

After your JSON Objected is already parsed, then you can access it's values as following:

alert(result.id);