Author

Topic: How do I extract the JSON balance data from this chain.com API call (Read 1636 times)

newbie
Activity: 1
Merit: 0

If you have a lot of JSON data that you just want to process once-only - you can use https://json-csv.com to convert it to a CSV file - then if you open the file up in a spreadsheet the balance will all be in the same column.
newbie
Activity: 14
Merit: 0
I'm new to PHP and I need help. I have a test wallet - and I want to extract the balance data from this API call from chain.com

{"hash":"16sxw3dFK4aq8WH8gzWDW8XjyutJojsKJG","balance":346929,"received":346929,"sent":0,"unconfirmed_received":0,"unconfirmed_sent":0,"unconfirmed_balance":0}

With PHP is there an easy way to parse this out? I tried the object class route but failed-

object(stdClass)#1 (7) {
  ["hash"]=>
  string(34) "16sxw3dFK4aq8WH8gzWDW8XjyutJojsKJG"
  ["balance"]=>
  int(346929)
  ["received"]=>
  int(346929)
  ["sent"]=>
  int(0)
  ["unconfirmed_received"]=>
  int(0)
  ["unconfirmed_sent"]=>
  int(0)
  ["unconfirmed_balance"]=>
  int(0)
}

Any help would be welcomed.
Jump to: