Home » Java » parsing – Unable to get parameters from JSONRPC2Response java-Exceptionshub

parsing – Unable to get parameters from JSONRPC2Response java-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I am trying to make some JSON RPC calls using the JSONRPC2 java library.I successfully managed to make the request and obtain the response result using response.getResult() which returns:

 "balance": [
        {
            "asset_hash": "e898b00e1a62c9ca0d857c2f220ce15a174edaa2",
            "amount": "9999997300000000",
            "last_updated_block": 2873
        }
    ],
    "address": "AXSMdLRLk2er8Rh2zpT1DSjjkBVXuYGkcv"

From this then I am able to get the “balance” and “address” as strings using the JSONObject.get() but I am not sure how I can further parse the “balance” String. My goal is to get the “amount” parameter. Is there some way to do this using the JSONRPC2 framework or do I have to parse it myself somehow?

How to&Answers: