org.json.JSONObject.optQuery()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(265)

本文整理了Java中org.json.JSONObject.optQuery()方法的一些代码示例,展示了JSONObject.optQuery()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.optQuery()方法的具体详情如下:
包路径:org.json.JSONObject
类名称:JSONObject
方法名:optQuery

JSONObject.optQuery介绍

[英]Queries and returns a value from this object using jsonPointer, or returns null if the query fails due to a missing key.
[中]使用jsonPointer查询并返回此对象中的值,如果由于缺少键而导致查询失败,则返回null。

代码示例

代码示例来源:origin: loklak/loklak_server

/**
 * Queries and returns a value from this object using {@code jsonPointer}, or
 * returns null if the query fails due to a missing key.
 * 
 * @param jsonPointer the string representation of the JSON pointer
 * @return the queried value or {@code null}
 * @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
 */
public Object optQuery(String jsonPointer) {
  return optQuery(new JSONPointer(jsonPointer));
}

代码示例来源:origin: b3log/latke

/**
 * Queries and returns a value from this object using {@code jsonPointer}, or
 * returns null if the query fails due to a missing key.
 * 
 * @param jsonPointer the string representation of the JSON pointer
 * @return the queried value or {@code null}
 * @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
 */
public Object optQuery(String jsonPointer) {
  return optQuery(new JSONPointer(jsonPointer));
}

代码示例来源:origin: org.b3log/latke

/**
 * Queries and returns a value from this object using {@code jsonPointer}, or
 * returns null if the query fails due to a missing key.
 * 
 * @param jsonPointer the string representation of the JSON pointer
 * @return the queried value or {@code null}
 * @throws IllegalArgumentException if {@code jsonPointer} has invalid syntax
 */
public Object optQuery(String jsonPointer) {
  return optQuery(new JSONPointer(jsonPointer));
}

相关文章

JSONObject类方法