Current JSON package to retrieve info from links

0 votes

I am currently trying to find a WORKING and CURRENT JSON files that would be able to pull JSON info from a link such as

https://api.coinmarketcap.com/v1/ticker/bitcoin/?convert=CAD

With that link when you click on that it will display CURRENT prices for bitcoin.

All the libraries I downloaded for JSON is either fragmented or very out of date by years.

Why hasn’t JSON been standard for JAVA projects? But I digress.

If you click on the above link it displays info on bitcoin. I am only interested in one field and that is "price_cad". Which JSON is most recommended that is current and up-to-date and can achieve the desired results.

I reviewed the Question Parsing JSON in JAVA usng Gson. I found that this was not exactly what I was looking for.

Can someone help me with this?

Sep 6, 2018 in Blockchain by digger
• 27,620 points
17 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
public static String btcvalue(){
        String msg = "";
        try {
            URL url = new URL("https://api.coinmarketcap.com/v1/ticker/bitcoin/?convert=CAD");
            System.setProperty("http.agent", "Chrome");
            BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
            String str = "";
            while (null != (str = br.readLine())) {
                msg = msg + str;
            }
            String decodedText = msg;
            String[] parts = decodedText.split("price_cad");
            String[] amnt = parts[1].split(",");
            String[] finn = amnt[0].split(":");
            msg = finn[1].replace("\"", "");
        } catch (Exception ex) {
            ex.printStackTrace();
            msg = "10.000";
        }
        return msg;
    }
answered Sep 6, 2018 by slayer
• 29,040 points

Related Questions In Blockchain

0 votes
1 answer

How to retrieve data from a block to a blockchain?

web3.eth.getTransaction(txHash) will returns transaction details like blockHash, transactionIndex, ...READ MORE

answered Jun 26, 2018 in Blockchain by Perry
• 16,450 points
37 views
0 votes
1 answer

How can I retrieve to and from address in transaction directly from blockchain?

The spending conditions, i.e., who is able ...READ MORE

answered Jul 11, 2018 in Blockchain by Shashank
• 10,330 points
46 views
0 votes
1 answer

How to retrieve data from an Ethereum Block?

To get transaction details like Block Hash ...READ MORE

answered Jul 19, 2018 in Blockchain by Perry
• 16,450 points
27 views
0 votes
1 answer

How to parse Json data from remote server?

Yes, you can do it use the ...READ MORE

answered Aug 17, 2018 in Blockchain by digger
• 27,620 points
20 views
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by ariaholic
• 7,320 points
42 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
61 views
0 votes
1 answer
0 votes
1 answer

How to retrieve complete world state of hyperledger?

you can achieve this by iteration process ...READ MORE

answered Jul 5, 2018 in Blockchain by slayer
• 29,040 points
135 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.