I'm struggling to find examples of ko.observablearrays that deal with complex JSON objects instead of simple strings. I have an observable array containing a large JSON object with several properties, and I need to retrieve a specific object based on its id property. Here's the code snippet I currently have for getting the Id:
self.selectedOrgId.subscribe(function (currentOrgId) {
alert(currentOrgId);
}, self);
The observable array is populated using an ajax get request and looks something like this:
[
{"userGuid":"37ab100e-f97b-462a-b3f4-79b8fbe24831",
"orgId":1,
"orgName":
"company ltd",
"isHiring":true,
...snip...}
more...
]
Could someone help me figure out how to search through my array and retrieve the object with the matching orgId?