Answer the question
In order to leave comments, you need to log in
How to properly implement json search?
There is a JSON array:
[
{
"id": 1,
"collection_id": 5,
"code": "triniti_001",
"name": "Тринити 001",
"variant" : [
{"wood" : 1, "glass" : 0, "form" : 1},
{"wood" : 2, "glass" : 0, "form" : 1},
{"wood" : 3, "glass" : 0, "form" : 1}
]
},
{
"id": 2,
"collection_id": 5,
"code": "triniti_002",
"name": "Тринити 002"
},
{
"id": 3,
"collection_id": 5,
"code": "triniti_003",
"name": "Тринити 003"
}
]
{
"id": 1,
"collection_id": 5,
"code": "triniti_001",
"name": "Тринити 001",
"variant" : [
{"wood" : 1, "glass" : 0, "form" : 1},
{"wood" : 2, "glass" : 0, "form" : 1},
{"wood" : 3, "glass" : 0, "form" : 1}
]
},
Answer the question
In order to leave comments, you need to log in
No underscore needed here. Everything is beautifully written in pure JavaScript. A simple loop or Array.some() if you want functionality.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question