org.eclipse.jetty.util.ajax.JSON.parse()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(218)

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

JSON.parse介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@SuppressWarnings("unchecked")
private static Map<String, Object> parse(String jsonString) {
 return (Map<String, Object>)JSON.parse(jsonString);
}

代码示例来源:origin: apache/hbase

@Test
@SuppressWarnings("unchecked")
public void testWriteJson() throws Exception {
 StringWriter sw = new StringWriter();
 ConfServlet.writeResponse(getTestConf(), sw, "json");
 String json = sw.toString();
 boolean foundSetting = false;
 Set<String> programSet = new HashSet<>();
 programSet.add("programatically");
 programSet.add("programmatically");
 Object parsed = JSON.parse(json);
 Object[] properties = ((Map<String, Object[]>)parsed).get("properties");
 for (Object o : properties) {
  Map<String, Object> propertyInfo = (Map<String, Object>)o;
  String key = (String)propertyInfo.get("key");
  String val = (String)propertyInfo.get("value");
  String resource = (String)propertyInfo.get("resource");
  System.err.println("k: " + key + " v: " + val + " r: " + resource);
  if (TEST_KEY.equals(key) && TEST_VAL.equals(val)
    && programSet.contains(resource)) {
   foundSetting = true;
  }
 }
 assertTrue(foundSetting);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * @param in
 *            Reader containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(Reader in, boolean stripOuterComment) throws IOException
{
  return DEFAULT.parse(new ReaderSource(in),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * @param s
 *            String containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s)
{
  return DEFAULT.parse(new StringSource(s),false);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * @param s
 *            String containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s, boolean stripOuterComment)
{
  return DEFAULT.parse(new StringSource(s),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server

/**
 * Convert JSON to Object
 *
 * @param json
 *            The json to convert
 * @return The object
 */
public Object fromJSON(String json)
{
  Source source = new StringSource(json);
  return parse(source);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util-ajax

/**
 * @param s
 *            String containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s, boolean stripOuterComment)
{
  return DEFAULT.parse(new StringSource(s),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util-ajax

/**
 * @param in
 *            Reader containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 * @throws IOException if unable to parse
 */
public static Object parse(Reader in) throws IOException
{
  return DEFAULT.parse(new ReaderSource(in),false);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

/**
 * @param s
 *            String containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s)
{
  return DEFAULT.parse(new StringSource(s),false);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * @param s
 *            String containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s)
{
  return DEFAULT.parse(new StringSource(s),false);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * @param in
 *            Reader containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(Reader in) throws IOException
{
  return DEFAULT.parse(new ReaderSource(in),false);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * @param in
 *            Reader containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(Reader in, boolean stripOuterComment) throws IOException
{
  return DEFAULT.parse(new ReaderSource(in),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

/**
 * @param s
 *            String containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s, boolean stripOuterComment)
{
  return DEFAULT.parse(new StringSource(s),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-plus

/**
 * Convert JSON to Object
 *
 * @param json
 *            The json to convert
 * @return The object
 */
public Object fromJSON(String json)
{
  Source source = new StringSource(json);
  return parse(source);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util-ajax

/**
 * @param s
 *            String containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s)
{
  return DEFAULT.parse(new StringSource(s),false);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util-ajax

/**
 * @param in
 *            Reader containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 * @throws IOException if unable to parse
 */
public static Object parse(Reader in, boolean stripOuterComment) throws IOException
{
  return DEFAULT.parse(new ReaderSource(in),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

/**
 * @param s
 *            String containing JSON object or array.
 * @param stripOuterComment
 *            If true, an outer comment around the JSON is ignored.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
public static Object parse(String s, boolean stripOuterComment)
{
  return DEFAULT.parse(new StringSource(s),stripOuterComment);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-webapp

/**
 * Convert JSON to Object
 *
 * @param json
 *            The json to convert
 * @return The object
 */
public Object fromJSON(String json)
{
  Source source = new StringSource(json);
  return parse(source);
}

代码示例来源:origin: org.eclipse.jetty/jetty-util-ajax

/**
 * @param in
 *            Reader containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 * @throws IOException if unable to parse
 * @deprecated use {@link #parse(Reader)}
 */
@Deprecated
public static Object parse(InputStream in) throws IOException
{
  return DEFAULT.parse(new StringSource(IO.toString(in)),false);
}

代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-server

/**
 * @deprecated use {@link #parse(Reader)}
 * @param in
 *            Reader containing JSON object or array.
 * @return A Map, Object array or primitive array parsed from the JSON.
 */
@Deprecated
public static Object parse(InputStream in) throws IOException
{
  return DEFAULT.parse(new StringSource(IO.toString(in)),false);
}

相关文章