Title: blockchain.info api outputting 'invalid' json Post by: payb.tc on January 27, 2013, 03:32:22 PM consider the following output from blockchain.info's api:
Quote {"balance":100500000,"address":1HBaNtmXhWSvrud63SRnCoeqcX5ovjXJRu,"total_received":100500000} this is causing my code to hug trees* on this line: Code: $blah = json_decode($response); ...because the address string is not being presented as a string (in quotes). putting the above JSON into http://jsonlint.com yields the following message: Quote from: jsonlint.com Parse error on line 3: ...000, "address": 1HBaNtmXhWSvrud63SRn ----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[' i can create a work-around myself by manually putting quotes around anything that looks like an address, before decoding, but it'd be a bit dodgey... ...anyone else encountered this issue? what did you do about it? ben, is this something you could possibly change in blockchain.info's output? cheers. *quit being a productive member of society Title: Re: blockchain.info api outputting 'invalid' json Post by: piuk on January 27, 2013, 09:02:09 PM ben, is this something you could possibly change in blockchain.info's output? Yes this can be fixed fairly easily. I just need to know which exact API call is the invalid JSON coming from? Title: Re: blockchain.info api outputting 'invalid' json Post by: payb.tc on January 27, 2013, 09:17:58 PM ben, is this something you could possibly change in blockchain.info's output? Yes this can be fixed fairly easily. I just need to know which exact API call is the invalid JSON coming from? thanks, it's from the address_balance url: Quote from: http://blockchain.info/api/blockchain_wallet_api Getting the balance of an address Retreive the balance of a bitcoin address. Querying the balance of an address by label is depreciated. https://blockchain.info/merchant/$guid/address_balance?password=$main_password&address=$address&confirmations=$confirmations Title: Re: blockchain.info api outputting 'invalid' json Post by: piuk on January 28, 2013, 05:16:14 PM This error should be fixed now.
Title: Re: blockchain.info api outputting 'invalid' json Post by: payb.tc on January 28, 2013, 09:07:51 PM |