org.json.simple
类 JSONValue

java.lang.Object
  继承者 org.json.simple.JSONValue

public class JSONValue
extends java.lang.Object

作者:
FangYidong

构造方法摘要
JSONValue()
           
 
方法摘要
static java.lang.String escape(java.lang.String s)
          Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).
static java.lang.Object parse(java.io.Reader in)
          Parse JSON text into java object from the input source.
static java.lang.Object parse(java.lang.String s)
           
static java.lang.Object parseWithException(java.io.Reader in)
          Parse JSON text into java object from the input source.
static java.lang.Object parseWithException(java.lang.String s)
           
static java.lang.String toJSONString(java.lang.Object value)
          Convert an object to JSON text.
static void writeJSONString(java.lang.Object value, java.io.Writer out)
          Encode an object into JSON text and write it to out.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

JSONValue

public JSONValue()
方法详细信息

parse

public static java.lang.Object parse(java.io.Reader in)
Parse JSON text into java object from the input source. Please use parseWithException() if you don't want to ignore the exception.

参数:
in -
返回:
Instance of the following: org.json.simple.JSONObject, org.json.simple.JSONArray, java.lang.String, java.lang.Number, java.lang.Boolean, null
另请参见:
JSONParser.parse(Reader), parseWithException(Reader)

parse

public static java.lang.Object parse(java.lang.String s)

parseWithException

public static java.lang.Object parseWithException(java.io.Reader in)
                                           throws java.io.IOException,
                                                  ParseException
Parse JSON text into java object from the input source.

参数:
in -
返回:
Instance of the following: org.json.simple.JSONObject, org.json.simple.JSONArray, java.lang.String, java.lang.Number, java.lang.Boolean, null
抛出:
java.io.IOException
ParseException
另请参见:
JSONParser

parseWithException

public static java.lang.Object parseWithException(java.lang.String s)
                                           throws ParseException
抛出:
ParseException

writeJSONString

public static void writeJSONString(java.lang.Object value,
                                   java.io.Writer out)
                            throws java.io.IOException
Encode an object into JSON text and write it to out.

If this object is a Map or a List, and it's also a JSONStreamAware or a JSONAware, JSONStreamAware or JSONAware will be considered firstly.

DO NOT call this method from writeJSONString(Writer) of a class that implements both JSONStreamAware and (Map or List) with "this" as the first parameter, use JSONObject.writeJSONString(Map, Writer) or JSONArray.writeJSONString(List, Writer) instead.

参数:
value -
writer -
抛出:
java.io.IOException
另请参见:
JSONObject.writeJSONString(Map, Writer), JSONArray.writeJSONString(List, Writer)

toJSONString

public static java.lang.String toJSONString(java.lang.Object value)
Convert an object to JSON text.

If this object is a Map or a List, and it's also a JSONAware, JSONAware will be considered firstly.

DO NOT call this method from toJSONString() of a class that implements both JSONAware and Map or List with "this" as the parameter, use JSONObject.toJSONString(Map) or JSONArray.toJSONString(List) instead.

参数:
value -
返回:
JSON text, or "null" if value is null or it's an NaN or an INF number.
另请参见:
JSONObject.toJSONString(Map), JSONArray.toJSONString(List)

escape

public static java.lang.String escape(java.lang.String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F).

参数:
s -
返回:


Copyright © 2012. All Rights Reserved.