i haven't an idea of how to find the key in my json array.
if i checking finding key by function parameter it doesn't work.
Part of my json data:
...
{
"product": [
{
"title": "myProductTitle",
...
This code return object correctly:
function getKey(json, key)
{
console.log(key);//has string "myProductTitle"
let obj = json.product.find(item => item.title === "myProductTitle");
return obj;
}
This code return empty object:
function getKey(json, key)
{
console.log(key);//has string "myProductTitle"
let obj = json.product.find(item => item.title === key);
return obj;
}
How to do this correctly?