Filter Array Using Partial String Match in Javascript

I have an array of objects where the value I need to filter on is buried in a long string. Array looks like:

                          {
                            "data": {
                              "value": "{\"cols\":[\"parent_sku\"],\"label\":\"Style\",\"description\":\"Enter Style.\",\"placeholderText\":\"Style 10110120103\"}",
                              "partnerId": 1
                            }
                          },

So if I wanted to grab all the partnerId objects where value includes parent_sku how would I do that?

console.log(data.value.includes('parent_sku') returns cannot read property 'includes' of null.

Leave a Comment