Page 1 of 1

String into array

Posted: Thu Mar 07, 2013 9:04 pm
by Temor
I can really tell that I haven't been writing much code recently as I cannot even solve this simple problem.
Thankfully, I have you guys!

Here is an API output:

{"username":"Temor","balance":"102.73083724150007552344","total_earned":"284.25394566150007632000","total_hashrate":"919.25","workers":{"Temor.1":{"hashrate":"919.25"},"Temor.2":{"hashrate":"0.00"}},"24h_earnings":28.713264186831}



I wish to split this into an array, and have done so successfully, but the problem occurs at "workers". I want it to be a separate array, containing the workers information.

Could anyone guide me in the right direction here? ( I'll probably be able to do this myself after I've refreshed my brain a bit. I'm just stuck right now :P )

Re: String into array

Posted: Fri Mar 08, 2013 4:32 pm
by Temor
It took me this long to figure out that the output was JSON.
Speedy brain! Speedy.

SOLVED :D

Re: String into array

Posted: Fri Mar 08, 2013 10:10 pm
by Helx
Only 19 hours.
New record. :P

Re: String into array

Posted: Fri Mar 08, 2013 11:06 pm
by Temor
All I had to do was get a few hours of sleep and it all came back to me :)

Re: String into array

Posted: Sat Mar 09, 2013 4:00 am
by EcazS
Temor wrote:All I had to do was get a few hours of sleep and it all came back to me :)

That's the normal problem. Debugging ain't possible unless you sleep first.

Re: String into array

Posted: Sat Mar 09, 2013 4:51 pm
by Temor
I tend to forget things like that if I haven't been coding actively for a while.
But it feels soooo good coming back to a piece of code that you've written but have no idea what it does and figuring it out :D


/Edit, this thread is going a bit of topic now. Locking it to avoid a total derail!! :)