0

enter image description here

const result = array.stores.filter(y=> y.store_id == store_id);
console.log("result")

I tried this but no value is filtered. Can anyone suggest me simple method to filter XML data and get the value whatever is searched.

Another problem is how to convert XML data to JSON data in the node

vanshaj
  • 499
  • 1
  • 4
  • 13
nirup m
  • 33
  • 8
  • You cannot filter on xml. Convert that xml string to json first – vanshaj Feb 23 '21 at 13:56
  • var filteredArray = getdata .filter(element => element.stores .some(subElement => subElement.store_id === postData.store_id || subElement.store_name === postData.store_name) ) .map(element => { let n = Object.assign({}, element, {'stores': element.stores.filter( subElement => subElement.store_id === postData.store_id || subElement.store_name === postData.store_name )}) return n; }) for json data filtering only – nirup m Feb 25 '21 at 12:10

0 Answers0