I want to search inside a JSON file with the following format:
{
"success": true,
"msg": "",
"obj": [
{
"id": 1,
"up": 546636462,
"down": 4172830061,
"total": 53687091200,
"name": "حامد ",
"enable": true,
"expiryTime": 1667049201686,
"listen": "",
"dork": 23050,
"net": "girltik",
"settings": "{\n \"clients\": [\n {\n \"id\": \"f8c36812-11e0-47c4-9880-2c8ff9310c49\",\n \"alterId\": 0\n }\n ],\n \"disableInsecureEncryption\": false\n}",
"streamSettings": "{\n \"network\": \"ws\",\n \"security\": \"none\",\n \"wsSettings\": {\n \"path\": \"/\",\n \"headers\": {}\n }\n}",
"tag": "inbound-23050",
"sniffing": "{\n \"enabled\": true,\n \"destOverride\": [\n \"http\",\n \"tls\"\n ]\n}"
},
{
"id": 2,
"up": 25559864,
"down": 630133850,
"total": 5368709120,
"remark": "احمد ",
"enable": true,
"expiryTime": 1667051159682,
"listen": "",
"dork": 36606,
"net": "girltik",
"settings": "{\n \"clients\": [\n {\n \"id\": \"902b0800-6bbd-4874-f7f8-980deb8d37e8\",\n \"alterId\": 0\n }\n ],\n \"disableInsecureEncryption\": false\n}",
"streamSettings": "{\n \"network\": \"ws\",\n \"security\": \"none\",\n \"wsSettings\": {\n \"path\": \"/\",\n \"headers\": {}\n }\n}",
"tag": "inbound-36606",
"sniffing": "{\n \"enabled\": true,\n \"destOverride\": [\n \"http\",\n \"tls\"\n ]\n}"
}
]
}
I want to filter it by word f8c36812-11e0-47c4-9880-2c8ff9310c49
in settings
property, so that the result array contains only the matching objects:
{
"success": true,
"msg": "",
"obj": [
{
"id": 1,
"up": 546636462,
"down": 4172830061,
"total": 53687091200,
"remark": "حامد پاشائی",
"enable": true,
"expiryTime": 1667049201686,
"listen": "",
"port": 23050,
"protocol": "vmess",
"settings": "{\n \"clients\": [\n {\n \"id\": \"f8c36812-11e0-47c4-9880-2c8ff9310c49\",\n \"alterId\": 0\n }\n ],\n \"disableInsecureEncryption\": false\n}",
"streamSettings": "{\n \"network\": \"ws\",\n \"security\": \"none\",\n \"wsSettings\": {\n \"path\": \"/\",\n \"headers\": {}\n }\n}",
"tag": "inbound-23050",
"sniffing": "{\n \"enabled\": true,\n \"destOverride\": [\n \"http\",\n \"tls\"\n ]\n}"
}
]
}
How can I filter an array from a JSON file using PHP?