Answer the question
In order to leave comments, you need to log in
How to search on a large json file?
Hello.
There is a file with a base of post offices of new mail, which is stored in json format. The file itself contains several thousand entries. How can search by key be organized in such a way that it would spend less resources?
Solutions like this result in a 504 error on my laptop. I also used generators, the situation does not change
$findByRef = function($ref) use ($objitems) {
foreach ($objitems as $warehouse) {
if ($warehouse->Ref == $ref) return $warehouse->description;
}
return false;
};
{
"success": true,
"data": [{
"SiteKey": "19709",
"Description": "\u041f\u0443\u043d\u043a\u0442 \u043f\u0440\u0438\u0439\u043c\u0430\u043d\u043d\u044f-\u0432\u0438\u0434\u0430\
...........................
}, {
"SiteKey": "18142",
"Description": "\u041f\u0443\u043d\u043a\u0442 \u043f\u0440\u0438\u0439\u043c\u0430\u043d\u043d\u044f-\u0432\u0438\u0434\u0430\
..............
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question