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

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

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

JSONObject.stringToValue介绍

[英]Try to convert a string into a number, boolean, or null. If the string can't be converted, return the string.
[中]尝试将字符串转换为数字、布尔值或null。如果无法转换字符串,请返回该字符串。

代码示例

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

/**
 * This method is the same as {@link JSONObject#stringToValue(String)}
 * except that this also tries to unescape String values.
 * 
 * @param string String to convert
 * @return JSON value of this string or the string
 */
public static Object stringToValue(String string) {
  return JSONObject.stringToValue(string);
}

代码示例来源:origin: zzz40500/GsonFormat

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

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

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

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

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: org.codeartisans/org.json

/**
 * This method has been deprecated in favor of the
 * {@link JSONObject.stringToValue(String)} method. Use it instead.
 * 
 * @deprecated Use JSONObject#stringToValue(String) instead.
 * @param string String to convert
 * @return JSON value of this string or the string
 */
@Deprecated
public static Object stringToValue(String string) {
  return JSONObject.stringToValue(string);
}

代码示例来源:origin: com.pojosontheweb/woko-core

@SuppressWarnings("unchecked")
private Object stringToValue(String str) throws JSONException {
  if (str.startsWith("[")) {
    // array
    JSONArray a = new JSONArray(str);
    List al = new ArrayList();
    for (int i=0 ; i<a.length() ; i++) {
      Object elem = a.get(i);
      if (elem!=null) {
        al.add(stringToValue(elem.toString()));
      }
    }
    return al;
  }
  return JSONObject.stringToValue(str);
}

代码示例来源:origin: com.xmlcalabash/xmlcalabash

throw syntaxError("Missing value");
return JSONObject.stringToValue(s);

代码示例来源:origin: org.dynamicloud.api/dynamicloud

throw syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: io.snappydata/gemfire-json

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: quux00/hive-json-schema

throw syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: org.json/com.springsource.org.json

throw syntaxError("Missing value");
return JSONObject.stringToValue(s);

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

throw syntaxError("Missing value");
return JSONObject.stringToValue(s);

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

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: org.codeartisans/org.json

throw this.syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: uk.org.retep.tools/util

throw syntaxError("Missing value");
return JSONObject.stringToValue(s);

代码示例来源:origin: org.owasp.jbrofuzz/jbrofuzz

throw syntaxError("Missing value");
return JSONObject.stringToValue(s);

代码示例来源:origin: ndw/xmlcalabash1

throw syntaxError("Missing value");
return JSONObject.stringToValue(s);

代码示例来源:origin: com.unboundid.components/json

throw syntaxError("Missing value");
return JSONObject.stringToValue(string);

代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.json

value = JSONObject.stringToValue(new String(bytes, 0, length,
      "US-ASCII"));
} catch (UnsupportedEncodingException e) {

相关文章

微信公众号

最新文章

更多

JSONObject类方法