Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

David Jarrin
PLUS
David Jarrin
Courses Plus Student 11,182 Points

Having trouble parsing this json

object(stdClass)#369 (2) { ["status"]=> object(stdClass)#18390 (2) { ["code"]=> int(200) ["message"]=> string(8) "Success." } ["results"]=> array(3) { [0]=> object(stdClass)#18391 (3) { ["symbol"]=> string(3) "HPQ" ["name"]=> string(23) "Hewlett-Packard Company" ["marketCap"]=> int(51734941406) } [1]=> object(stdClass)#18392 (3) { ["symbol"]=> string(5) "LNVGY" ["name"]=> string(20) "Lenovo Group Ltd ADR" ["marketCap"]=> int(10097769531) } [2]=> object(stdClass)#18393 (3) { ["symbol"]=> string(3) "DDD" ["name"]=> string(15) "3D Systems Corp" ["marketCap"]=> int(1373099976) } } }

when I try to pull individual pieces of data like so $json_competitors -> {'symbol'} I get nothing

I said this is wordpress because I am trying to pull this in on a wordpress site

1 Answer

David Jarrin
PLUS
David Jarrin
Courses Plus Student 11,182 Points

I Apologize this wasn't too hard.... just needed to use something like $json_competitors -> {'results'}[0]->{'symbol'}

Its much easier to see once you put the json into a code editor and format it correctly.