I'm trying to append some JSON I'm getting from an API response to an email and I wish to output the JSON into a HTML table. The problem is the JSON response doesn't look like anything I've worked with before.
$vs_getClickPath = wp_remote_get('url');
$clickPath_body = wp_remote_retrieve_body( $vs_getClickPath );
$notification['message'] .= $clickPath_body;
This gives me the below:
[
["date\/time", "page name visited", "city", "region", "country", "company name\/isp", "identity", "search\/referral"],
["2016-05-17 10:56:05", "Home Page", "Buffalo", "New York", "United States", "I-evolve Technology Services", "", ""]
]
All of the keys come first in one array then in another array the values show up. Trying to work with indexes just gets the individual characters, foreach doesn't work. I've tried json_decode
, but it doesn't output anything with print_r
or var_dump
.
Is there anyway I will be able to loop through this and output the data into a HTML table? The first array would be the table headers and every array after that would be the table rows.