I am using jQuery to make an ajax request to an MVC controller which then submits an object, and returns back a JSON representation of the object which gets returned back to ajax request. The JSON that is being returned looks like this:
[
{
"Account_LocationDevices": [],
"Account_ChannelTransactions": [],
"Account_Location_PaymentTypes": [],
"ID": 56,
"AccountID": 1,
"Name": "b",
"Address1": "",
"Address2": "",
"City": "",
"State": "",
"ZipCode": "",
"Country": "",
}
]
I then need to be able to access certain 'nodes' of this JSON array, or convert this back into an object and access it via the object. Anyone have any suggestions on how to take this JSON result and transform it back into an object or access certain parts of the array, without using index numbers in case a schema were changed?
Here is the jQuery doing the work
$.ajax({
type: "POST",
url: "../Company/MicrosoftRMSStoreOperations",
data: { locationName: inputValue },
datatype: "json",
beforeSend: function () {
},
success: function (data) {
alert("Location successfully added!");
$('#locationDropDown').append(
$('<option></option>').val().html()
);
$('#inputAddLocation').val("");
$('#AddLocation').animate({
width: 'toggle',
}, 100, function() {
//after animation
});
// window.location.href = window.location.href;
},
error: function () {
alert("Appears the database Gods did not agree");
}
});