basic JSON pull from bitcoin link

Skip to first unread message

Derek Hill

Jan 19, 2018, 10:55:57 PM1/19/18
to google-gson
Trying to parse JSON data from this link

I have tried several different ways but can never get anything to work as there is compiling errors.

I am frustrated that something that would normally be simple cant seem to function right.

I have tried several ways and no success.

All i want is to retrieve the canadian price.

"price_cad": "14187.6214876", 

This is all i want.

Can someone help me out here? I have given up on stackoverflow as their solutions are never working, outdated or just simply errors in compiling left right and center. and yes i was looking up on GSON guides.

Steve Gazzo

Jul 20, 2018, 1:20:43 PM7/20/18
to google-gson
Posting your code would help, but looking at the raw data from that endpoint I'd caution you that JSON objects are enclosed in {}, and this is enclosed in [], indicating an array of JSON objects of length 1 in this case, rather than a single object.

Data is attached for easy reference

        "id": "bitcoin", 
        "name": "Bitcoin", 
        "symbol": "BTC", 
        "rank": "1", 
        "price_usd": "7483.33", 
        "price_btc": "1.0", 
        "24h_volume_usd": "4643940000.0", 
        "market_cap_usd": "128416000716", 
        "available_supply": "17160275.0", 
        "total_supply": "17160275.0", 
        "max_supply": "21000000.0", 
        "percent_change_1h": "-0.0", 
        "percent_change_24h": "0.87", 
        "percent_change_7d": "19.56", 
        "last_updated": "1532102899", 
        "price_cad": "9845.0359947", 
        "24h_volume_cad": "6109547014.12", 
        "market_cap_cad": "168943525054"
Reply all
Reply to author
0 new messages