I am attempting to retrieve the text from the JSON response below:
{
"threaded_extended": {},
"messages": [
{
"body": {
"parsed": "the network. Take a moment to welcome Jason.",
"plain": " network. Take a moment to welcome Jason.",
"rich": "Jason."
},
"thread_id": 56,
"client_type": "Wb",
"client_url": "https://www.yammer.com/",
"system_message": true,
"direct_message": false,
"chat_client_sequence": null,
"language": "en",
"notified_user_ids": [],
"system_message_properties": {
"subtype": "created_membership"
},
"privacy": "public",
"attachments": [],
"liked_by": {
"count": 0,
"names": []
},
"content_excerpt": " Jason.",
"group_created_id": null
}
]
} My function is designed like this, but it keeps returning 'undefined' - I apologize if this is a silly question, my reasoning is that the object has a value, then messages is an attribute, and plain should be an attribute of that. Am I making a mistake somewhere? Any help would be appreciated.
function getData(returnData){
$.each(returnData, function(key, value){
if(value != undefined){
$('#test').append(value.messages.plain);
}
});
}