Skip to content
Advertisement

find value in JSON from list in text file

What I am trying to accomplish: Use contents of a text file to search for values in JSON file.

My text file contains one entry per line. The will match values in the JSON file.

JavaScript

I would like to iterate this list and return matches from the JSON file

JavaScript
JavaScript

I have also tried including a for loop before the first for loop. I get back only the last entry in the text file.

JavaScript

Advertisement

Answer

Remove the newlines from the lines in ua, and turn it into a set. Then you can test if i['appid'] is in the set.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement