Hello! I am attempting to retrieve new data from an API by filtering it with a JSON file. My goal is to filter the data from the API using the JSON file and extract any new information.
const jsnf = JSON.stringify(fs.readFileSync("./data.json", "utf8"));
const res = await axios.get("https://fortnite-api.com/v2/cosmetics/br/new")
const data1 = res.data.data.items;
const data2 = JSON.stringify(data1)
const data3 = JSON.stringify(Object.values(data1), null, 2)
In addition, I attempted to log data3 (data from the JSON file) and received: result for data3 (console.log(data3) )
I also logged data1 (data from the API) and got: result for data1 (console.log(data1) )
[ If I do:
console.log(data1.filter((x) => jsnf.includes(x)))
I will get an empty array []
]
If you know how to achieve [ console.log(jsnf == data1) \\ true
OR
[ console.log(data1.filter((x) => jsnf.includes(x))) ] \\ x = new items from the API ] please share your insights, thank you!