Here is a string I'm working with:
configValues="{listValues:[{name:chennai,attrs:[{id:1,name:kumar},{id:2,name:john}]},{name:bengalur,attrs:[{id:1,name:raj},{id:2,name:nick}]}]}"
This string contains a list of values based on city. I am trying to convert it into a JSON object and filter based on the name field.
I attempted the following method, but it resulted in an error stating "filter of undefined"
var inputString=JSON.parse(JSON.stringify('configValues'));
var outputString= inputString.listValues.filter(val=> val.name ==='chennai')
Can anyone assist me in converting this string to JSON and filtering using typescript?