Basically I'd like to store the value market_price_usd from the json into my variable marketPriceUsd in the class Price, but when I try to print it out I only get a null or 0.0 output, it only works with some of the variables stored.
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
System.out.println(content);
Gson gson = new Gson();
price riv = gson.fromJson(content.toString(), price.class);
System.out.println(content);
System.out.println(riv.marketPriceUsd);
package test;
public class price {
public double timestamp;
public double marketPriceUsd;
public double hashRate;
public long totalFeesBtc;
public long nBtcMined;
public long nTx;
public long nBlocksMined;
public double minutesBetweenBlocks;
public long totalbc;
public long nBlocksTotal;
public double estimatedTransactionVolumeUsd;
public long blocksSize;
public double minersRevenueUsd;
public long nextretarget;
public long difficulty;
public long estimatedBtcSent;
public long minersRevenueBtc;
public long totalBtcSent;
public double tradeVolumeBtc;
public double tradeVolumeUsd;
}