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

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

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

JSON.parse介绍

暂无

代码示例

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

/**
 * @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.mortbay.jetty/jetty-util

source.next();
Object value=contextFor(name).parse(source);
map.put(name,value);

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

/** Construct a literal JSON instance for use by {@link JSON#toString(Object)}.
 * If {@link Log#isDebugEnabled()} is true, the JSON will be parsed to check validity
 * @param json A literal JSON string. 
 */
public Literal(String json)
{
  if (Log.isDebugEnabled())
    parse(json);
  _json=json;
}

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

/**
 * @param s Stream 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.mortbay.jetty/jetty-util

/**
 * @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.mortbay.jetty/jetty-util

/**
 * @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.mortbay.jetty/jetty-util

/** 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.mortbay.jetty/jetty-util

/**
 * @deprecated use {@link #parse(Reader, boolean)}
 * @param s Stream 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(InputStream in, boolean stripOuterComment) throws IOException
{
  return __default.parse(new StringSource(IO.toString(in)),stripOuterComment);
}

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

/**
 * @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.
 */
public static Object parse(InputStream in) throws IOException
{
  return __default.parse(new StringSource(IO.toString(in)),false);
}

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

return parse(source);
    else if (o==null)
      o=parse(source);
      continue;

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

item=contextForArray().parse(source);
else if (list==null)
  item=contextForArray().parse(source);
  list.add(item);
  item=null;
  item=contextForArray().parse(source);
  list.add(item);
  item=null;

代码示例来源:origin: org.opencb.biodata/biodata-formats

@Override
public List<Variant> read() {
  String line = null;
  try {
    line = reader.readLine();
  } catch (IOException e) {
    e.printStackTrace();
  }
  return line != null
      ? Collections.singletonList(new Variant(jsonObjectMapper.convertValue(JSON.parse(line), VariantAvro.class)))
      : null;
}

代码示例来源:origin: org.mortbay.jetty/cometd-jetty

public Message[] parse(String s) throws IOException
{
  Object batch=_batchJSON.parse(new JSON.StringSource(s));
  if (batch==null)
    return new Message[0]; 
  if (batch.getClass().isArray())
    return (Message[])batch;
  return new Message[]{(Message)batch};
}

代码示例来源:origin: org.mortbay.jetty/cometd-server

public Message[] parse(String s) throws IOException
{
  Object batch=_batchJSON.parse(new JSON.StringSource(s));
  if (batch == null)
    return new Message[0];
  if (batch.getClass().isArray())
    return (Message[])batch;
  return new Message[]
  {(Message)batch};
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

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

代码示例来源:origin: org.mortbay.jetty/cometd-server

public void parseTo(String fodder, List<Message> messages)
{
  Object batch=_batchJSON.parse(new JSON.StringSource(fodder));
  if (batch == null)
    return;
  if (batch.getClass().isArray())
  {
    Message[] msgs=(Message[])batch;
    for (int m=0; m < msgs.length; m++)
      messages.add(msgs[m]);
  }
  else
    messages.add((Message)batch);
}

代码示例来源:origin: org.mortbay.jetty/cometd-server

protected Object filterJSON(Client from, Channel to, JSON.Generator generator)
{
  String json=JSON.toString(generator);
  Object data=JSON.parse(json);
  return filter(from,to,data);
}

代码示例来源:origin: org.mortbay.jetty/cometd-server

protected Object filterJSON(Client from, Channel to, JSON.Literal json)
{
  Object data=JSON.parse(json.toString());
  return filter(from,to,data);
}

代码示例来源:origin: org.mortbay.jetty/cometd-jetty

protected Object filterJSON(Client from, Channel to, JSON.Literal json)
{
  Object data = JSON.parse(json.toString());
  return filter(from,to,data);
}

代码示例来源:origin: org.mortbay.jetty/cometd-jetty

protected Object filterJSON(Client from, Channel to, JSON.Generator generator)
{
  String json = JSON.toString(generator);
  Object data = JSON.parse (json);
  return filter(from,to,data);
}

相关文章