I'm trying to write a custom filter where you can type a "string" and it will filter all the values in a large object and see if it exists.
Example Object:
{
"status": "active",
"terms": [
{
"sourcedId": "AS8032021110",
"type": "academicSession",
"status": "",
"startDate": null,
"endDate": null,
"responseMsg": "",
"responseInt": 0
},
{
"sourcedId": "AS8032021120",
"type": "academicSession",
"status": "",
"startDate": null,
"endDate": null,
"responseMsg": "",
"responseInt": 0
}
],
"integrationClassId": "CLS170316",
"integrationSiteId": "ENT803",
"grades": [
"01"
],
"lastSync": "11\/13\/2020 5:59:59 PM",
"koSync": null,
"dropDate": null,
"id": 0,
"userLinkId": 0,
"classId": 0,
"schClass": {
"classId": 0,
"siteId": 0,
"userLinkCount": 0,
"integrationType": 10,
"userLinkId": 0,
"name": "MUSIC 1ST GRD-1MUSIC\/3",
"nickName": null,
"appId": null,
"deleted": null,
"integrationId": "",
"responseMsg": "",
"responseInt": 0
},
"deleteDate": null,
"responseMsg": "",
"responseInt": 0
}
What would be the best approach to see if this object has a "string" for a value. I have to work with a large array of these objects, and want to let people use a global search. So if I typed "CLS" it would return all objects with integrationClassId that has "CLS" in it. Then if they typed "MUSIC 1ST GRD" it would return all the objects with schClass.name with that name.
My thought process was to flatten this entire thing into a 1 simple array of values. How would I make 1 array with just all of these values? I have a mix of arrays of objects, array, and object in this!