本文整理了Java中com.alibaba.fastjson.JSONObject.getDouble()
方法的一些代码示例,展示了JSONObject.getDouble()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.getDouble()
方法的具体详情如下:
包路径:com.alibaba.fastjson.JSONObject
类名称:JSONObject
方法名:getDouble
暂无
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public Double getDouble(String key) {
return jsonObject.getDouble(key);
}
代码示例来源:origin: uber/chaperone
JSONObject oldMetricsInJSON = JSON.parseObject(metricsInStr);
long count = oldMetricsInJSON.getLong("count");
double meanLatency = oldMetricsInJSON.getDouble("mean");
double p95Latency = oldMetricsInJSON.getDouble("mean95");
代码示例来源:origin: ltsopensource/light-task-scheduler
@Override
public Double getDouble(String key) {
return jsonObject.getDouble(key);
}
代码示例来源:origin: aliyun/aliyun-odps-java-sdk
/**
* 获取 instance 进度
*
* @return progress
*/
public Double getProgress() {
return properties.getDouble("instanceProgress");
}
代码示例来源:origin: com.github.ltsopensource/lts-core
@Override
public Double getDouble(String key) {
return jsonObject.getDouble(key);
}
代码示例来源:origin: syhily/elasticsearch-jdbc
@Override
public Double getDouble(String key) {
return jsonObject.getDouble(key);
}
代码示例来源:origin: whvcse/EasyWeb
/**
* 得到Double类型的值
*/
public static Double getDouble(String json, String key) {
Double result = null;
try {
JSONObject jsonObject = JSON.parseObject(json);
result = jsonObject.getDouble(key);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
代码示例来源:origin: cn.leancloud/realtime-core
@Override
protected void parseAdditionalMetaData(final Map<String, Object> meta, JSONObject formatInfo) {
if (null == meta || null == formatInfo) {
return;
}
String fileFormat = formatInfo.getString("format_name");
Double durationInDouble = formatInfo.getDouble("duration");
long size = formatInfo.getLong(FILE_SIZE);
meta.put(FILE_SIZE, size);
meta.put(DURATION, durationInDouble);
meta.put(FORMAT, fileFormat);
}
代码示例来源:origin: cn.leancloud/realtime-core
@Override
protected void parseAdditionalMetaData(final Map<String, Object> meta, JSONObject formatInfo) {
if (null == meta || null == formatInfo) {
return;
}
String fileFormat = formatInfo.getString("format_name");
Double durationInDouble = formatInfo.getDouble("duration");
long size = formatInfo.getLong(FILE_SIZE);
meta.put(FILE_SIZE, size);
meta.put(DURATION, durationInDouble);
meta.put(FORMAT, fileFormat);
}
}
代码示例来源:origin: com.github.1991wangliang/lorne_core
public static double getDouble(String json, String key,
double defaultVal) {
JSONObject jsonObject = JSONObject.parseObject(json);
try {
if (jsonObject == null) {
return defaultVal;
}
if (jsonObject.containsKey(key)) {
return jsonObject.getDouble(key);
} else {
return defaultVal;
}
} catch (Exception e) {
return defaultVal;
}
}
代码示例来源:origin: KKys/ZhiHuSpider
private void setPrice(String priceUrl){
JSONArray json = null;
BufferedReader in = null;
try {
// 定义HttpClient
HttpClient client = new DefaultHttpClient();
// 实例化HTTP方法
HttpGet request = new HttpGet();
request.setURI(new URI(priceUrl));
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
//只有一行数据,如 [{"id":"J_2172006","p":"108.00","m":"168.00"}]
json = JSON.parseArray(in.readLine());
this.price = json.getJSONObject(0).getDouble("p");
} catch (Exception e){
} finally {
if (in != null) {
try {
in.close();// 最后要关闭BufferedReader
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
代码示例来源:origin: KKys/ZhiHuSpider
private void setComment(String commentUrl){
JSONObject json = null;
BufferedReader in = null;
try {
// 定义HttpClient
HttpClient client = new DefaultHttpClient();
// 实例化HTTP方法
HttpGet request = new HttpGet();
request.setURI(new URI(commentUrl));
HttpResponse response = client.execute(request);
in = new BufferedReader(new InputStreamReader(response.getEntity().getContent(),"gbk"));
json = JSON.parseObject(in.readLine());
JSONObject productCommentSummary = json.getJSONObject("productCommentSummary");
//总评价数
int commentCount = productCommentSummary.getInteger("commentCount");
//好评率
double goodRate = productCommentSummary.getDouble("goodRate");
this.commentCount = commentCount;
this.goodRate = goodRate;
} catch (Exception e){
} finally {
if (in != null) {
try {
in.close();// 最后要关闭BufferedReader
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
代码示例来源:origin: cn.leancloud.android/avoscloud-push
@Override
public void onSuccess(String content, AVException e) {
try {
com.alibaba.fastjson.JSONObject response = JSON.parseObject(content);
com.alibaba.fastjson.JSONObject formatInfo = response.getJSONObject(FORMAT);
String fileFormat = formatInfo.getString("format_name");
Double durationInDouble = formatInfo.getDouble("duration");
long size = formatInfo.getLong(FILE_SIZE);
meta.put(FILE_SIZE, size);
meta.put(DURATION, durationInDouble);
meta.put(FORMAT, fileFormat);
} catch (Exception e1) {
callback.internalDone(new AVException(e1));
}
callback.internalDone(null);
}
代码示例来源:origin: cn.leancloud.android/avoscloud-push
@Override
public void onSuccess(String content, AVException e) {
try {
com.alibaba.fastjson.JSONObject response = JSON.parseObject(content);
com.alibaba.fastjson.JSONObject formatInfo = response.getJSONObject(FORMAT);
String fileFormat = formatInfo.getString("format_name");
Double durationInDouble = formatInfo.getDouble("duration");
long size = formatInfo.getLong(FILE_SIZE);
meta.put(FILE_SIZE, size);
meta.put(DURATION, durationInDouble);
meta.put(FORMAT, fileFormat);
} catch (Exception e1) {
callback.internalDone(new AVException(e1));
}
callback.internalDone(null);
}
代码示例来源:origin: com.gitee.qdbp/qdbp-general-biz
if (config.getString("resultcode.success").equals(code)) {
log.trace("Query sms balances success. result: {}", result);
return json.getDouble("num");
} else {
String desc = json.getString("msg");
代码示例来源:origin: aliyun/aliyun-odps-console
private Double getSQLInputSizeInGB() {
try {
String queryResult = runSQLCostTask();
JSONObject node = JSON.parseObject(queryResult);
if (!node.containsKey("Cost") || !node.getJSONObject("Cost").containsKey("SQL") ||
!node.getJSONObject("Cost").getJSONObject("SQL").containsKey("Input")) {
return null;
}
Double input = node.getJSONObject("Cost").getJSONObject("SQL").getDouble("Input");
if (input != null) {
return input / 1024 / 1024 / 1024;
}
} catch (Exception e) {
// ignore
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!