Есть массив JSON:
[
{
"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}
]
},
по, например, "code": "triniti_001" ?