Bitcoin Forum
December 15, 2017, 11:05:48 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: blockchain.info api outputting 'invalid' json  (Read 2281 times)
payb.tc
Hero Member
*****
Offline Offline

Activity: 812



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

Posts: 1513335948

View Profile Personal Message (Offline)

Ignore
1513335948
Reply with quote  #2

1513335948
Report to moderator
1513335948
Hero Member
*
Offline Offline

Posts: 1513335948

View Profile Personal Message (Offline)

Ignore
1513335948
Reply with quote  #2

1513335948
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513335948
Hero Member
*
Offline Offline

Posts: 1513335948

View Profile Personal Message (Offline)

Ignore
1513335948
Reply with quote  #2

1513335948
Report to moderator
1513335948
Hero Member
*
Offline Offline

Posts: 1513335948

View Profile Personal Message (Offline)

Ignore
1513335948
Reply with quote  #2

1513335948
Report to moderator
1513335948
Hero Member
*
Offline Offline

Posts: 1513335948

View Profile Personal Message (Offline)

Ignore
1513335948
Reply with quote  #2

1513335948
Report to moderator
piuk
Hero Member
*****
Offline Offline

Activity: 910



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

Activity: 812



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



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

This error should be fixed now.

payb.tc
Hero Member
*****
Offline Offline

Activity: 812



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

This error should be fixed now.

thanks!
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!