Having trouble parsing a particular json return

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

nydeveloper
New php-forum User
New php-forum User
Posts: 1
Joined: Sat Feb 08, 2014 2:08 pm

Having trouble parsing a particular json return

Postby nydeveloper » Sat Feb 08, 2014 2:13 pm

I'm having a really tough time using curl to parse the following data, which is returned as JSON via a URL. What I need to do is take the lowest 'price' found within 'sellorders' and assign it to a local variable, and then take the highest price found within 'buyorders' and assign that to a second local variable. Any help here is greatly appreciated.

{"success":1,"return":{"test":{"marketid":"32","label":"test\/TEST1","primaryname":"TestItem","primarycode":"ABC","secondaryname":
"Tester","secondarycode":"TES","sellorders":[{"price":"0.00002894","quantity":"13.31323200","total":"0.00038528"},{"price":"0.00002895","quantity":"92.80350000","total":"0.00268666"},{"price":"0.00002897","quantity":"392.60350000","total":"0.01137372"},{"price":"0.00002900","quantity":"392.50350000","total":"0.01138260"},{"price":"0.00002902","quantity":"785.40700000","total":"0.02279251"},],"buyorders":[{"price":"0.00002734","quantity":"93.16130210","total":"0.00254703"},{"price":"0.00002733","quantity":"2.00000000","total":"0.00005466"},{"price":"0.00002731","quantity":"2.31057540","total":"0.00006310"},{"price":"0.00002599","quantity":"3.73174150","total":"0.00009699"}]}}}

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest