My JSON object is constructed like this:
var Source =
{
Object: [ //Array
{Title: 'Test', Type: 'Pet', Category: 'Cat', Description: 'Fluffy', Count: 2 }
]
};
I was able to figure out how to properly add to the 'Object' array, but I can't seem to figure out the jQuery syntax to query the object based on the property list (Title, Type, Category, etc).
I put some test code into a click event and normally check the length of the Source.Object (Test data results in 2 objects) to confirm that there is data to work with (It's populated through an ajax call).
function clickTest(category, type) {
$(Source).find('Object[Category=\"' + category + '\"]').each(function() {
alert($(this).attr('Category')); //doesn't work
});
}
What is the right way to query a JSON object like this?