Answer the question
In order to leave comments, you need to log in
Parse json in PHP
I have a multidimensional JSON array:
{
"date2" : "20140616",
"min" : {
"denial" : 0,
"visits" : 4,
"new_visitors_perc" : 0.4343,
"page_views" : 12,
"visit_time" : 70 ,
"depth" : 1.733,
"new_visitors" : 3,
"visitors" : 4
},
"max" : {
"denial" : 0.2988,
"visits" : 396,
"new_visitors_perc" : 0.75,
"page_views" : 1017,
" visit_time" : 157,
"depth" : 3,
"new_visitors" : 226,
"visitors" : 354
},
"data" : [
{
"wday" : 0,
"denial" : 0,
"visits" : 4,
"new_visitors_perc" : 0.75,
"page_views" : 12,
"date" : "20140616",
"visit_time" : 82,
"depth" : 3,
"new_visitors" : 3,
"visitors" : 4,
"id" : "20140616"
},
{
"wday" : 6,
"denial" : 0.2045,
"visits" : 176,
"new_visitors_perc" : 0.5542,
"page_views" : 393,
"date" : "20140615",
"visit_time" : 104,
"depth" : 2.233,
"new_visitors" : 92,
"visitors" : 166,
"id" : "20140615"
},
{
etc
It is necessary to output in the end in the following form:
"date": "value",
"visits": value,
"pageviews": value
And so for each of the elements .
And if it's even more difficult: how to get it all in reverse order? Those. so that the last element in the array is the first in the response?
How to do it?
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