Answer the question
In order to leave comments, you need to log in
How to read data from json using php?
Good time of the day!
Tell me, who knows how to correctly read certain data from a json file!?
The file has the following structure:
{
"site": [
{
"tab": {
"lookup": "primer_pole",
"label": "primer"
},
"settings": [
{
"lookup": "qw_qw",
"label": "qwqw",
"type": "text",
"access": "normal"
}
]
},
{
"tab": {
"lookup": "mail-form",
"label": "mail-form"
},
"settings": [
{
"lookup": "email",
"label": "email",
"type": "text",
"access": "normal",
"value": "[email protected]"
}
]
}
]
}
Answer the question
In order to leave comments, you need to log in
<?php
$str = '{
"site":[
{
"tab":{
"lookup":"primer_pole",
"label":"primer"
},
"settings":[
{
"lookup":"qw_qw",
"label":"qwqw",
"type":"text",
"access":"normal"
}
]
},
{
"tab":{
"lookup":"mail-form",
"label":"mail-form"
},
"settings":[
{
"lookup":"email",
"label":"email",
"type":"text",
"access":"normal",
"value":"[email protected]"
}
]
}
]
}';
$json = json_decode($str, true);
$email = $json['site'][1]['settings'][0]['value'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question