Answer the question
In order to leave comments, you need to log in
How to read json value?
Hey! There is a .json file:
{
"posts" : [
{
"id" : 0,
"title" : "Авто 1",
"description" : "Описание",
"active" : true
},
{
"id" : 1,
"title" : "Авто 2",
"description" : "Описание",
"active" : true
}
]
}
{
"id" : 1,
"title" : "Авто 2",
"description" : "Описание",
"active" : true
}
Авто 2
$json = file_get_contents('file.json');
$json_read= json_decode($json, true);
$json_read['posts'][0]['id']['value']
{ "posts" : [ { "id" : 0, "title" : "Авто 1", "description" : "Описание", "active" : true }, { "id" : 1, "title" : "Авто 2", "description" : "Описание", "active" : true } ] }
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