com.googlecode.fascinator.common
Class JsonObject
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<Object,Object>
com.googlecode.fascinator.common.JsonObject
- All Implemented Interfaces:
- Serializable, Cloneable, Map<Object,Object>, org.json.simple.JSONAware, org.json.simple.JSONStreamAware
public class JsonObject
- extends LinkedHashMap<Object,Object>
- implements Map<Object,Object>, org.json.simple.JSONAware, org.json.simple.JSONStreamAware
This class is and all code is a direct copy of the org.json.simple.JSONObject
implementation found here:
http://json-simple.googlecode.com/svn/trunk/src/org
/json/simple/JSONObject.java
It has been duplicated for the sole purpose of moving to a LinkedHashMap to
preserve order. All credit must go to the original authors.
Because JSONValue.escape() is inaccessible from outside the original package
it needed to be added to the end of the class as well.
A JSON object. Key value pairs are unordered. JSONObject supports
java.util.Map interface.
- Author:
- FangYidong
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
|
Method Summary |
static String |
escape(String s)
Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F). |
String |
toJSONString()
|
static String |
toJSONString(Map<?,?> map)
|
String |
toString()
|
static String |
toString(String key,
Object value)
|
static void |
writeJSONString(Map<?,?> map,
Writer out)
|
void |
writeJSONString(Writer out)
|
| Methods inherited from interface java.util.Map |
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
JsonObject
public JsonObject()
JsonObject
public JsonObject(Map<?,?> map)
writeJSONString
public static void writeJSONString(Map<?,?> map,
Writer out)
throws IOException
- Throws:
IOException
writeJSONString
public void writeJSONString(Writer out)
throws IOException
- Specified by:
writeJSONString in interface org.json.simple.JSONStreamAware
- Throws:
IOException
toJSONString
public static String toJSONString(Map<?,?> map)
toJSONString
public String toJSONString()
- Specified by:
toJSONString in interface org.json.simple.JSONAware
toString
public String toString()
- Overrides:
toString in class AbstractMap<Object,Object>
toString
public static String toString(String key,
Object value)
escape
public static String escape(String s)
- Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters
(U+0000 through U+001F). It's the same as JSONValue.escape() only for
compatibility here.
- Parameters:
s -
- Returns:
- See Also:
JSONValue.escape(String)
Copyright © 2009-2012. All Rights Reserved.