I'm trying to pull in the JSON data from my API, and get the data out of each key to display nicely in HTML/CSS. Right now having trouble getting the data.
This is my db object:
[ { "_id":"54bd5fbb646174009a450001", "productname":"Product 1", "overview":"Overview Title", "benefits": [ "List item 1", "List item 2", "List item 3" ] } ] I found this answer here, and the var_dump is working, it displays my db object on the page. This is my updated wordpress php plugin:
<?php add_shortcode('mis', function($atts, $data) { $service_url = 'http://local.web.tt.com:8615/api/users'; // Initiate curl $ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL,$service_url); $result=curl_exec($ch); curl_close($ch); // Will dump a beauty json :3 // var_dump(json_decode($result, true)); $data = (json_decode($result, true)); var_dump($data); $data = add_shortcode ( array( 'name' => 'name', 'overview' => 'overview', 'benefits' => 'benefits' ), $data ); extract($data); $content .=' <style>li { margin-left: 20px; }</style> <h2>$name</h2> <p>$overview</p> <ul> <li>$data["benefits"][0]</li> <li>$data["benefits"][2]</li> </ul>'; return $content; }); However I'm having trouble getting the data out:

This is where my problem is:
$data = (json_decode($result, true)); var_dump($data); $data = add_shortcode ( array( 'name' => 'name', 'overview' => 'overview', 'benefits' => 'benefits' ), $data ); extract($data); $content .=' <style>li { margin-left: 20px; }</style> <h2>$name</h2> <p>$overview</p> <ul> <li>$data["benefits"][0]</li> <li>$data["benefits"][1]</li> </ul>'; return $content; How do I get the data from the var_dump, into the right keys/vars in my $content variable?