Bitcoin Forum
May 25, 2024, 06:18:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: blockchain.info api outputting 'invalid' json  (Read 2378 times)
payb.tc (OP)
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
January 27, 2013, 03:32:22 PM
 #1

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
piuk
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1005



View Profile WWW
January 27, 2013, 09:02:09 PM
 #2

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?

payb.tc (OP)
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
January 27, 2013, 09:17:58 PM
 #3

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:

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
piuk
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1005



View Profile WWW
January 28, 2013, 05:16:14 PM
 #4

This error should be fixed now.

payb.tc (OP)
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1000



View Profile
January 28, 2013, 09:07:51 PM
 #5

This error should be fixed now.

thanks!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!