mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 05:36:45 +01:00
2351 lines
106 KiB
HTML
2351 lines
106 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="sv">
|
|
<head>
|
|
<!-- Generated by javadoc (version 1.7.0_67) on Sun Nov 16 11:09:55 CET 2014 -->
|
|
<title>JSONObject</title>
|
|
<meta name="date" content="2014-11-16">
|
|
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title = "JSONObject";
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar_top">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../com/intellectualcrafters/json/JSONML.html" title="class in com.intellectualcrafters.json"><span
|
|
class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../com/intellectualcrafters/json/JSONString.html"
|
|
title="interface in com.intellectualcrafters.json"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/intellectualcrafters/json/JSONObject.html" target="_top">Frames</a></li>
|
|
<li><a href="JSONObject.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if (window == top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#field_summary">Field</a> | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field_detail">Field</a> | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<div class="header">
|
|
<div class="subTitle">com.intellectualcrafters.json</div>
|
|
<h2 title="Class JSONObject" class="title">Class JSONObject</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>com.intellectualcrafters.json.JSONObject</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="strong">JSONObject</span>
|
|
extends java.lang.Object</pre>
|
|
<div class="block">A JSONObject is an unordered collection of name/value pairs. Its external
|
|
form is a string wrapped in curly braces with colons between the names and
|
|
values, and commas between the values and names. The internal form is an
|
|
object having <code>get</code> and <code>opt</code> methods for accessing
|
|
the values by name, and <code>put</code> methods for adding or replacing
|
|
values by name. The values can be any of these types: <code>Boolean</code>,
|
|
<code>JSONArray</code>, <code>JSONObject</code>, <code>Number</code>,
|
|
<code>String</code>, or the <code>JSONObject.NULL</code> object. A
|
|
JSONObject constructor can be used to convert an external form JSON text
|
|
into an internal form whose values can be retrieved with the <code>get</code>
|
|
and <code>opt</code> methods, or to convert values into a
|
|
JSON text using the <code>put</code> and <code>toString</code> methods. A
|
|
<code>get</code> method returns a value if one can be found, and throws an
|
|
exception if one cannot be found. An <code>opt</code> method returns a
|
|
default value instead of throwing an exception, and so is useful for
|
|
obtaining optional values.
|
|
<p/>
|
|
The generic <code>get()</code> and <code>opt()</code> methods return an
|
|
object, which you can cast or query for type. There are also typed
|
|
<code>get</code> and <code>opt</code> methods that do type checking and type
|
|
coercion for you. The opt methods differ from the get methods in that they do
|
|
not throw. Instead, they return a specified value, such as null.
|
|
<p/>
|
|
The <code>put</code> methods add or replace values in an object. For example,
|
|
<p/>
|
|
<pre>
|
|
myString = new JSONObject().put("JSON", "Hello, World!").toString();
|
|
</pre>
|
|
<p/>
|
|
produces the string <code>{"JSON": "Hello, World"}</code>.
|
|
<p/>
|
|
The texts produced by the <code>toString</code> methods strictly conform to
|
|
the JSON syntax rules. The constructors are more forgiving in the texts they
|
|
will accept:
|
|
<ul>
|
|
<li>An extra <code>,</code>
|
|
<small>(comma)</small>
|
|
may appear just
|
|
before the closing brace.
|
|
</li>
|
|
<li>Strings may be quoted with <code>'</code>
|
|
<small>(single
|
|
quote)
|
|
</small>
|
|
.
|
|
</li>
|
|
<li>Strings do not need to be quoted at all if they do not begin with a quote
|
|
or single quote, and if they do not contain leading or trailing spaces, and
|
|
if they do not contain any of these characters:
|
|
<code>{ } [ ] / \ : , #</code> and if they do not look like numbers and if
|
|
they are not the reserved words <code>true</code>, <code>false</code>, or
|
|
<code>null</code>.
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- =========== FIELD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="field_summary">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Field Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
|
|
summary="Field Summary table, listing fields, and an explanation">
|
|
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Field and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static java.lang.Object</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../com/intellectualcrafters/json/JSONObject.html#NULL">NULL</a></strong></code>
|
|
|
|
<div class="block">It is sometimes more convenient and less ambiguous to have a
|
|
<code>NULL</code> object than to use Java's <code>null</code> value.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_summary">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Constructor Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
|
|
summary="Constructor Summary table, listing constructors, and an explanation">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject()">JSONObject</a></strong>()</code>
|
|
|
|
<div class="block">Construct an empty JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(com.intellectualcrafters.json.JSONObject,%20java.lang.String[])">JSONObject</a></strong>(<a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> jo,
|
|
java.lang.String[] names)</code>
|
|
|
|
<div class="block">Construct a JSONObject from a subset of another JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(com.intellectualcrafters.json.JSONTokener)">JSONObject</a></strong>(<a
|
|
href="../../../com/intellectualcrafters/json/JSONTokener.html"
|
|
title="class in com.intellectualcrafters.json">JSONTokener</a> x)</code>
|
|
|
|
<div class="block">Construct a JSONObject from a JSONTokener.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(java.util.Map)">JSONObject</a></strong>(java.util.Map<java.lang.String,java.lang.Object> map)</code>
|
|
|
|
<div class="block">Construct a JSONObject from a Map.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(java.lang.Object)">JSONObject</a></strong>(java.lang.Object bean)</code>
|
|
|
|
<div class="block">Construct a JSONObject from an Object using bean getters.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(java.lang.Object,%20java.lang.String[])">JSONObject</a></strong>(java.lang.Object object,
|
|
java.lang.String[] names)</code>
|
|
|
|
<div class="block">Construct a JSONObject from an Object, using reflection to find the
|
|
public members.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(java.lang.String)">JSONObject</a></strong>(java.lang.String source)</code>
|
|
|
|
<div class="block">Construct a JSONObject from a source JSON text string.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#JSONObject(java.lang.String,%20java.util.Locale)">JSONObject</a></strong>(java.lang.String baseName,
|
|
java.util.Locale locale)</code>
|
|
|
|
<div class="block">Construct a JSONObject from a ResourceBundle.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method_summary">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Method Summary</h3>
|
|
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0"
|
|
summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#accumulate(java.lang.String,%20java.lang.Object)">accumulate</a></strong>(java.lang.String key,
|
|
java.lang.Object value)</code>
|
|
|
|
<div class="block">Accumulate values under a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#append(java.lang.String,%20java.lang.Object)">append</a></strong>(java.lang.String key,
|
|
java.lang.Object value)</code>
|
|
|
|
<div class="block">Append values to the array under a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#doubleToString(double)">doubleToString</a></strong>(double d)</code>
|
|
|
|
<div class="block">Produce a string from a double.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>java.lang.Object</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#get(java.lang.String)">get</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the value object associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getBoolean(java.lang.String)">getBoolean</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the boolean value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getDouble(java.lang.String)">getDouble</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the double value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getInt(java.lang.String)">getInt</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the int value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getJSONArray(java.lang.String)">getJSONArray</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the JSONArray value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getJSONObject(java.lang.String)">getJSONObject</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the JSONObject value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getLong(java.lang.String)">getLong</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the long value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static java.lang.String[]</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getNames(com.intellectualcrafters.json.JSONObject)">getNames</a></strong>(<a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> jo)</code>
|
|
|
|
<div class="block">Get an array of field names from a JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static java.lang.String[]</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getNames(java.lang.Object)">getNames</a></strong>(java.lang.Object object)</code>
|
|
|
|
<div class="block">Get an array of field names from an Object.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#getString(java.lang.String)">getString</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get the string associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#has(java.lang.String)">has</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Determine if the JSONObject contains a specific key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#increment(java.lang.String)">increment</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Increment a property of a JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#isNull(java.lang.String)">isNull</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Determine if the value associated with the key is null or if there is no
|
|
value.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>java.util.Iterator<java.lang.String></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#keys()">keys</a></strong>()</code>
|
|
|
|
<div class="block">Get an enumeration of the keys of the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>java.util.Set<java.lang.String></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#keySet()">keySet</a></strong>()</code>
|
|
|
|
<div class="block">Get a set of keys of the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#length()">length</a></strong>()</code>
|
|
|
|
<div class="block">Get the number of keys stored in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><strong><a href="../../../com/intellectualcrafters/json/JSONObject.html#names()">names</a></strong>()</code>
|
|
|
|
<div class="block">Produce a JSONArray containing the names of the elements of this
|
|
JSONObject.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#numberToString(java.lang.Number)">numberToString</a></strong>(java.lang.Number number)</code>
|
|
|
|
<div class="block">Produce a string from a Number.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>java.lang.Object</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#opt(java.lang.String)">opt</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optBoolean(java.lang.String)">optBoolean</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional boolean associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optBoolean(java.lang.String,%20boolean)">optBoolean</a></strong>(java.lang.String key,
|
|
boolean defaultValue)</code>
|
|
|
|
<div class="block">Get an optional boolean associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optDouble(java.lang.String)">optDouble</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional double associated with a key, or NaN if there is no such
|
|
key or if its value is not a number.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optDouble(java.lang.String,%20double)">optDouble</a></strong>(java.lang.String key,
|
|
double defaultValue)</code>
|
|
|
|
<div class="block">Get an optional double associated with a key, or the defaultValue if
|
|
there is no such key or if its value is not a number.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optInt(java.lang.String)">optInt</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional int value associated with a key, or zero if there is no
|
|
such key or if the value is not a number.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optInt(java.lang.String,%20int)">optInt</a></strong>(java.lang.String key,
|
|
int defaultValue)</code>
|
|
|
|
<div class="block">Get an optional int value associated with a key, or the default if there
|
|
is no such key or if the value is not a number.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optJSONArray(java.lang.String)">optJSONArray</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional JSONArray associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optJSONObject(java.lang.String)">optJSONObject</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional JSONObject associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optLong(java.lang.String)">optLong</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional long value associated with a key, or zero if there is no
|
|
such key or if the value is not a number.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optLong(java.lang.String,%20long)">optLong</a></strong>(java.lang.String key,
|
|
long defaultValue)</code>
|
|
|
|
<div class="block">Get an optional long value associated with a key, or the default if there
|
|
is no such key or if the value is not a number.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optString(java.lang.String)">optString</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Get an optional string associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#optString(java.lang.String,%20java.lang.String)">optString</a></strong>(java.lang.String key,
|
|
java.lang.String defaultValue)</code>
|
|
|
|
<div class="block">Get an optional string associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20boolean)">put</a></strong>(java.lang.String key,
|
|
boolean value)</code>
|
|
|
|
<div class="block">Put a key/boolean pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20java.util.Collection)">put</a></strong>(java.lang.String key,
|
|
java.util.Collection<java.lang.Object> value)</code>
|
|
|
|
<div class="block">Put a key/value pair in the JSONObject, where the value will be a
|
|
JSONArray which is produced from a Collection.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20double)">put</a></strong>(java.lang.String key,
|
|
double value)</code>
|
|
|
|
<div class="block">Put a key/double pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20int)">put</a></strong>(java.lang.String key,
|
|
int value)</code>
|
|
|
|
<div class="block">Put a key/int pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20long)">put</a></strong>(java.lang.String key,
|
|
long value)</code>
|
|
|
|
<div class="block">Put a key/long pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20java.util.Map)">put</a></strong>(java.lang.String key,
|
|
java.util.Map<java.lang.String,java.lang.Object> value)</code>
|
|
|
|
<div class="block">Put a key/value pair in the JSONObject, where the value will be a
|
|
JSONObject which is produced from a Map.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#put(java.lang.String,%20java.lang.Object)">put</a></strong>(java.lang.String key,
|
|
java.lang.Object value)</code>
|
|
|
|
<div class="block">Put a key/value pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#putOnce(java.lang.String,%20java.lang.Object)">putOnce</a></strong>(java.lang.String key,
|
|
java.lang.Object value)</code>
|
|
|
|
<div class="block">Put a key/value pair in the JSONObject, but only if the key and the value
|
|
are both non-null, and only if there is not already a member with that
|
|
name.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#putOpt(java.lang.String,%20java.lang.Object)">putOpt</a></strong>(java.lang.String key,
|
|
java.lang.Object value)</code>
|
|
|
|
<div class="block">Put a key/value pair in the JSONObject, but only if the key and the value
|
|
are both non-null.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#quote(java.lang.String)">quote</a></strong>(java.lang.String string)</code>
|
|
|
|
<div class="block">Produce a string in double quotes with backslash sequences in all the
|
|
right places.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static java.io.Writer</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#quote(java.lang.String,%20java.io.Writer)">quote</a></strong>(java.lang.String string,
|
|
java.io.Writer w)</code> </td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>java.lang.Object</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#remove(java.lang.String)">remove</a></strong>(java.lang.String key)</code>
|
|
|
|
<div class="block">Remove a name and its value, if present.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#similar(java.lang.Object)">similar</a></strong>(java.lang.Object other)</code>
|
|
|
|
<div class="block">Determine if two JSONObjects are similar.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static java.lang.Object</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#stringToValue(java.lang.String)">stringToValue</a></strong>(java.lang.String string)</code>
|
|
|
|
<div class="block">Try to convert a string into a number, boolean, or null.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static void</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#testValidity(java.lang.Object)">testValidity</a></strong>(java.lang.Object o)</code>
|
|
|
|
<div class="block">Throw an exception if the object is a NaN or infinite number.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code><a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#toJSONArray(com.intellectualcrafters.json.JSONArray)">toJSONArray</a></strong>(<a
|
|
href="../../../com/intellectualcrafters/json/JSONArray.html" title="class in com.intellectualcrafters.json">JSONArray</a> names)</code>
|
|
|
|
<div class="block">Produce a JSONArray containing the values of the members of this
|
|
JSONObject.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../com/intellectualcrafters/json/JSONObject.html#toString()">toString</a></strong>()</code>
|
|
|
|
<div class="block">Make a JSON text of this JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a href="../../../com/intellectualcrafters/json/JSONObject.html#toString(int)">toString</a></strong>(int indentFactor)</code>
|
|
|
|
<div class="block">Make a prettyprinted JSON text of this JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>static java.lang.String</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#valueToString(java.lang.Object)">valueToString</a></strong>(java.lang.Object value)</code>
|
|
|
|
<div class="block">Make a JSON text of an Object value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>static java.lang.Object</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#wrap(java.lang.Object)">wrap</a></strong>(java.lang.Object object)</code>
|
|
|
|
<div class="block">Wrap an object, if necessary.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>java.io.Writer</code></td>
|
|
<td class="colLast"><code><strong><a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html#write(java.io.Writer)">write</a></strong>(java.io.Writer writer)</code>
|
|
|
|
<div class="block">Write the contents of the JSONObject as JSON text to a writer.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Methods inherited from class java.lang.Object</h3>
|
|
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ============ FIELD DETAIL =========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="field_detail">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Field Detail</h3>
|
|
<a name="NULL">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>NULL</h4>
|
|
<pre>public static final java.lang.Object NULL</pre>
|
|
<div class="block">It is sometimes more convenient and less ambiguous to have a
|
|
<code>NULL</code> object than to use Java's <code>null</code> value.
|
|
<code>JSONObject.NULL.equals(null)</code> returns <code>true</code>.
|
|
<code>JSONObject.NULL.toString()</code> returns <code>"null"</code>.
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor_detail">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Constructor Detail</h3>
|
|
<a name="JSONObject()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject()</pre>
|
|
<div class="block">Construct an empty JSONObject.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(com.intellectualcrafters.json.JSONObject, java.lang.String[])">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(<a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> jo,
|
|
java.lang.String[] names)</pre>
|
|
<div class="block">Construct a JSONObject from a subset of another JSONObject. An array of
|
|
strings is used to identify the keys that should be copied. Missing keys
|
|
are ignored.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>jo</code> - A JSONObject.</dd>
|
|
<dd><code>names</code> - An array of strings.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code></dd>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If a value is
|
|
a non-finite number or if a name is
|
|
duplicated.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(com.intellectualcrafters.json.JSONTokener)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(<a href="../../../com/intellectualcrafters/json/JSONTokener.html"
|
|
title="class in com.intellectualcrafters.json">JSONTokener</a> x)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONObject from a JSONTokener.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>x</code> - A JSONTokener object containing the source string.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If there is a
|
|
syntax error in the source string or a
|
|
duplicated key.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(java.util.Map)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(java.util.Map<java.lang.String,java.lang.Object> map)</pre>
|
|
<div class="block">Construct a JSONObject from a Map.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>map</code> - A map object that can be used to initialize the contents of
|
|
the JSONObject.
|
|
</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(java.lang.Object bean)</pre>
|
|
<div class="block">Construct a JSONObject from an Object using bean getters. It reflects on
|
|
all of the public methods of the object. For each of the methods with no
|
|
parameters and a name starting with <code>"get"</code> or
|
|
<code>"is"</code> followed by an uppercase letter, the method is invoked,
|
|
and a key and the value returned from the getter method are put into the
|
|
new JSONObject.
|
|
<p/>
|
|
The key is formed by removing the <code>"get"</code> or <code>"is"</code>
|
|
prefix. If the second remaining character is not upper case, then the
|
|
first character is converted to lower case.
|
|
<p/>
|
|
For example, if an object has a method named <code>"getName"</code>, and
|
|
if the result of calling <code>object.getName()</code> is
|
|
<code>"Larry Fine"</code>, then the JSONObject will contain
|
|
<code>"name": "Larry Fine"</code>.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>bean</code> - An object that has getter methods that should be used to make
|
|
a JSONObject.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(java.lang.Object, java.lang.String[])">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(java.lang.Object object,
|
|
java.lang.String[] names)</pre>
|
|
<div class="block">Construct a JSONObject from an Object, using reflection to find the
|
|
public members. The resulting JSONObject's keys will be the strings from
|
|
the names array, and the values will be the field values associated with
|
|
those keys in the object. If a key is not found or not visible, then it
|
|
will not be copied into the new JSONObject.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>object</code> - An object that has fields that should be used to make a
|
|
JSONObject.
|
|
</dd>
|
|
<dd><code>names</code> - An array of strings, the names of the fields to be obtained
|
|
from the object.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(java.lang.String source)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONObject from a source JSON text string. This is the most
|
|
commonly used JSONObject constructor.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>source</code> - A string beginning with <code>{</code>
|
|
<small>(left
|
|
brace)
|
|
</small>
|
|
and ending with <code>}</code>
|
|
|
|
<small>(right brace)</small>
|
|
.
|
|
</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If there is a
|
|
syntax error in the source string or a
|
|
duplicated key.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject(java.lang.String, java.util.Locale)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(java.lang.String baseName,
|
|
java.util.Locale locale)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONObject from a ResourceBundle.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>baseName</code> - The ResourceBundle base name.</dd>
|
|
<dd><code>locale</code> - The Locale to load the ResourceBundle for.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If any
|
|
JSONExceptions are detected.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="method_detail">
|
|
<!-- -->
|
|
</a>
|
|
|
|
<h3>Method Detail</h3>
|
|
<a name="doubleToString(double)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>doubleToString</h4>
|
|
<pre>public static java.lang.String doubleToString(double d)</pre>
|
|
<div class="block">Produce a string from a double. The string "null" will be returned if the
|
|
number is not finite.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>d</code> - A double.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A String.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getNames(com.intellectualcrafters.json.JSONObject)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getNames</h4>
|
|
<pre>public static java.lang.String[] getNames(<a
|
|
href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> jo)</pre>
|
|
<div class="block">Get an array of field names from a JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An array of field names, or null if there are no names.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getNames(java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getNames</h4>
|
|
<pre>public static java.lang.String[] getNames(java.lang.Object object)</pre>
|
|
<div class="block">Get an array of field names from an Object.</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An array of field names, or null if there are no names.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="numberToString(java.lang.Number)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>numberToString</h4>
|
|
<pre>public static java.lang.String numberToString(java.lang.Number number)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Produce a string from a Number.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>number</code> - A Number</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A String.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If n is a
|
|
non-finite number.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="quote(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>quote</h4>
|
|
<pre>public static java.lang.String quote(java.lang.String string)</pre>
|
|
<div class="block">Produce a string in double quotes with backslash sequences in all the
|
|
right places. A backslash will be inserted within
|
|
</
|
|
, producing <\/,
|
|
allowing JSON text to be delivered in HTML. In JSON text, a string cannot
|
|
contain a control character or an unescaped quote or backslash.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>string</code> - A String</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A String correctly formatted for insertion in a JSON text.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="quote(java.lang.String, java.io.Writer)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>quote</h4>
|
|
<pre>public static java.io.Writer quote(java.lang.String string,
|
|
java.io.Writer w)
|
|
throws java.io.IOException</pre>
|
|
<dl>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code>java.io.IOException</code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="stringToValue(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>stringToValue</h4>
|
|
<pre>public static java.lang.Object stringToValue(java.lang.String string)</pre>
|
|
<div class="block">Try to convert a string into a number, boolean, or null. If the string
|
|
can't be converted, return the string.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>string</code> - A String.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A simple JSON value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="testValidity(java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>testValidity</h4>
|
|
<pre>public static void testValidity(java.lang.Object o)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Throw an exception if the object is a NaN or infinite number.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>o</code> - The object to test.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If o is a non-finite
|
|
number.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="valueToString(java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>valueToString</h4>
|
|
<pre>public static java.lang.String valueToString(java.lang.Object value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Make a JSON text of an Object value. If the object has an
|
|
value.toJSONString() method, then that method will be used to produce the
|
|
JSON text. The method is required to produce a strictly conforming text.
|
|
If the object does not contain a toJSONString method (which is the most
|
|
common case), then a text will be produced by other means. If the value
|
|
is an array or Collection, then a JSONArray will be made from it and its
|
|
toJSONString method will be called. If the value is a MAP, then a
|
|
JSONObject will be made from it and its toJSONString method will be
|
|
called. Otherwise, the value's toString method will be called, and the
|
|
result will be quoted.
|
|
<p/>
|
|
|
|
<p/>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>value</code> - The value to be serialized.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>a printable, displayable, transmittable representation of the
|
|
object, beginning with <code>{</code>
|
|
<small>(left
|
|
brace)
|
|
</small>
|
|
and ending with <code>}</code>
|
|
<small>(right
|
|
brace)
|
|
</small>
|
|
.
|
|
</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the value is or
|
|
contains an invalid number.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="wrap(java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>wrap</h4>
|
|
<pre>public static java.lang.Object wrap(java.lang.Object object)</pre>
|
|
<div class="block">Wrap an object, if necessary. If the object is null, return the NULL
|
|
object. If it is an array or collection, wrap it in a JSONArray. If it is
|
|
a map, wrap it in a JSONObject. If it is a standard property (Double,
|
|
String, et al) then it is already wrapped. Otherwise, if it comes from
|
|
one of the java packages, turn it into a string. And if it doesn't, try
|
|
to wrap it in a JSONObject. If the wrapping fails, then null is returned.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>object</code> - The object to wrap</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The wrapped value</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="accumulate(java.lang.String, java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>accumulate</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> accumulate(java.lang.String key,
|
|
java.lang.Object value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Accumulate values under a key. It is similar to the put method except
|
|
that if there is already an object stored under the key then a JSONArray
|
|
is stored under the key to hold all of the accumulated values. If there
|
|
is already a JSONArray, then the new value is appended to it. In
|
|
contrast, the put method replaces the previous value.
|
|
<p/>
|
|
If only one value is accumulated that is not a JSONArray, then the result
|
|
will be the same as using put. But if multiple values are accumulated,
|
|
then the result will be like append.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - An object to be accumulated under the key.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the value is an
|
|
invalid number or if the key is null.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="append(java.lang.String, java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>append</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> append(java.lang.String key,
|
|
java.lang.Object value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Append values to the array under a key. If the key does not exist in the
|
|
JSONObject, then the key is put in the JSONObject with its value being a
|
|
JSONArray containing the value parameter. If the key was already
|
|
associated with a JSONArray, then the value parameter is appended to it.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - An object to be accumulated under the key.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the key is null or
|
|
if the current value associated with
|
|
the key is not a JSONArray.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="get(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>get</h4>
|
|
<pre>public java.lang.Object get(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the value object associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The object associated with the key.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is not
|
|
found.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBoolean(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBoolean</h4>
|
|
<pre>public boolean getBoolean(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the boolean value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the value is not a
|
|
Boolean or the String "true" or
|
|
"false".
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getDouble(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getDouble</h4>
|
|
<pre>public double getDouble(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the double value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The numeric value.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is not
|
|
found or if the value is not a Number
|
|
object and cannot be converted to a number.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getInt(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getInt</h4>
|
|
<pre>public int getInt(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the int value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The integer value.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is not
|
|
found or if the value cannot be converted
|
|
to an integer.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getJSONArray(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getJSONArray</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a> getJSONArray(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the JSONArray value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A JSONArray which is the value.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is not
|
|
found or if the value is not a JSONArray.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getJSONObject(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getJSONObject</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> getJSONObject(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the JSONObject value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A JSONObject which is the value.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is not
|
|
found or if the value is not a JSONObject.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getLong(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getLong</h4>
|
|
<pre>public long getLong(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the long value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The long value.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is not
|
|
found or if the value cannot be converted
|
|
to a long.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getString(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getString</h4>
|
|
<pre>public java.lang.String getString(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Get the string associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A string which is the value.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if there is no string
|
|
value for the key.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="has(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>has</h4>
|
|
<pre>public boolean has(java.lang.String key)</pre>
|
|
<div class="block">Determine if the JSONObject contains a specific key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>true if the key exists in the JSONObject.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="increment(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>increment</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> increment(java.lang.String key)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Increment a property of a JSONObject. If there is no such property,
|
|
create one with a value of 1. If there is such a property, and if it is
|
|
an Integer, Long, Double, or Float, then add one to it.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If there is already a
|
|
property with this name that is not an
|
|
Integer, Long, Double, or Float.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="isNull(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isNull</h4>
|
|
<pre>public boolean isNull(java.lang.String key)</pre>
|
|
<div class="block">Determine if the value associated with the key is null or if there is no
|
|
value.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>true if there is no value associated with the key or if the value
|
|
is the JSONObject.NULL object.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keys()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keys</h4>
|
|
<pre>public java.util.Iterator<java.lang.String> keys()</pre>
|
|
<div class="block">Get an enumeration of the keys of the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An iterator of the keys.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keySet()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keySet</h4>
|
|
<pre>public java.util.Set<java.lang.String> keySet()</pre>
|
|
<div class="block">Get a set of keys of the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A keySet.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="length()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>length</h4>
|
|
<pre>public int length()</pre>
|
|
<div class="block">Get the number of keys stored in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The number of keys in the JSONObject.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="names()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>names</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a> names()</pre>
|
|
<div class="block">Produce a JSONArray containing the names of the elements of this
|
|
JSONObject.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A JSONArray containing the key strings, or null if the JSONObject
|
|
is empty.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="opt(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>opt</h4>
|
|
<pre>public java.lang.Object opt(java.lang.String key)</pre>
|
|
<div class="block">Get an optional value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value, or null if there is no value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBoolean(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBoolean</h4>
|
|
<pre>public boolean optBoolean(java.lang.String key)</pre>
|
|
<div class="block">Get an optional boolean associated with a key. It returns false if there
|
|
is no such key, or if the value is not Boolean.TRUE or the String "true".
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBoolean(java.lang.String, boolean)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBoolean</h4>
|
|
<pre>public boolean optBoolean(java.lang.String key,
|
|
boolean defaultValue)</pre>
|
|
<div class="block">Get an optional boolean associated with a key. It returns the
|
|
defaultValue if there is no such key, or if it is not a Boolean or the
|
|
String "true" or "false" (case insensitive).
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optDouble(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optDouble</h4>
|
|
<pre>public double optDouble(java.lang.String key)</pre>
|
|
<div class="block">Get an optional double associated with a key, or NaN if there is no such
|
|
key or if its value is not a number. If the value is a string, an attempt
|
|
will be made to evaluate it as a number.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A string which is the key.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optDouble(java.lang.String, double)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optDouble</h4>
|
|
<pre>public double optDouble(java.lang.String key,
|
|
double defaultValue)</pre>
|
|
<div class="block">Get an optional double associated with a key, or the defaultValue if
|
|
there is no such key or if its value is not a number. If the value is a
|
|
string, an attempt will be made to evaluate it as a number.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optInt(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optInt</h4>
|
|
<pre>public int optInt(java.lang.String key)</pre>
|
|
<div class="block">Get an optional int value associated with a key, or zero if there is no
|
|
such key or if the value is not a number. If the value is a string, an
|
|
attempt will be made to evaluate it as a number.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optInt(java.lang.String, int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optInt</h4>
|
|
<pre>public int optInt(java.lang.String key,
|
|
int defaultValue)</pre>
|
|
<div class="block">Get an optional int value associated with a key, or the default if there
|
|
is no such key or if the value is not a number. If the value is a string,
|
|
an attempt will be made to evaluate it as a number.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optJSONArray(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optJSONArray</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a> optJSONArray(java.lang.String key)</pre>
|
|
<div class="block">Get an optional JSONArray associated with a key. It returns null if there
|
|
is no such key, or if its value is not a JSONArray.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A JSONArray which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optJSONObject(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optJSONObject</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> optJSONObject(java.lang.String key)</pre>
|
|
<div class="block">Get an optional JSONObject associated with a key. It returns null if
|
|
there is no such key, or if its value is not a JSONObject.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A JSONObject which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optLong(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optLong</h4>
|
|
<pre>public long optLong(java.lang.String key)</pre>
|
|
<div class="block">Get an optional long value associated with a key, or zero if there is no
|
|
such key or if the value is not a number. If the value is a string, an
|
|
attempt will be made to evaluate it as a number.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optLong(java.lang.String, long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optLong</h4>
|
|
<pre>public long optLong(java.lang.String key,
|
|
long defaultValue)</pre>
|
|
<div class="block">Get an optional long value associated with a key, or the default if there
|
|
is no such key or if the value is not a number. If the value is a string,
|
|
an attempt will be made to evaluate it as a number.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optString(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optString</h4>
|
|
<pre>public java.lang.String optString(java.lang.String key)</pre>
|
|
<div class="block">Get an optional string associated with a key. It returns an empty string
|
|
if there is no such key. If the value is not a string and is not null,
|
|
then it is converted to a string.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A string which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optString(java.lang.String, java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optString</h4>
|
|
<pre>public java.lang.String optString(java.lang.String key,
|
|
java.lang.String defaultValue)</pre>
|
|
<div class="block">Get an optional string associated with a key. It returns the defaultValue
|
|
if there is no such key.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A string which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, boolean)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
boolean value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/boolean pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A boolean which is the value.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the key is null.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, java.util.Collection)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
java.util.Collection<java.lang.Object> value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/value pair in the JSONObject, where the value will be a
|
|
JSONArray which is produced from a Collection.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A Collection value.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, double)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
double value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/double pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A double which is the value.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the key is null or
|
|
if the number is invalid.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
int value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/int pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - An int which is the value.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the key is null.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, long)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
long value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/long pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A long which is the value.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the key is null.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, java.util.Map)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
java.util.Map<java.lang.String,java.lang.Object> value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/value pair in the JSONObject, where the value will be a
|
|
JSONObject which is produced from a Map.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A Map value.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put(java.lang.String, java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> put(java.lang.String key,
|
|
java.lang.Object value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/value pair in the JSONObject. If the value is null, then the
|
|
key will be removed from the JSONObject if it is present.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - An object which is the value. It should be of one of these
|
|
types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
|
|
String, or the JSONObject.NULL object.
|
|
</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the value is
|
|
non-finite number or if the key is null.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="putOnce(java.lang.String, java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>putOnce</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> putOnce(java.lang.String key,
|
|
java.lang.Object value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/value pair in the JSONObject, but only if the key and the value
|
|
are both non-null, and only if there is not already a member with that
|
|
name.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - string</dd>
|
|
<dd><code>value</code> - object</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - if the key is a
|
|
duplicate
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="putOpt(java.lang.String, java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>putOpt</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONObject.html"
|
|
title="class in com.intellectualcrafters.json">JSONObject</a> putOpt(java.lang.String key,
|
|
java.lang.Object value)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Put a key/value pair in the JSONObject, but only if the key and the value
|
|
are both non-null.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - An object which is the value. It should be of one of these
|
|
types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
|
|
String, or the JSONObject.NULL object.
|
|
</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the value is a
|
|
non-finite number.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="remove(java.lang.String)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>remove</h4>
|
|
<pre>public java.lang.Object remove(java.lang.String key)</pre>
|
|
<div class="block">Remove a name and its value, if present.</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>key</code> - The name to be removed.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The value that was associated with the name, or null if there was
|
|
no value.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="similar(java.lang.Object)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>similar</h4>
|
|
<pre>public boolean similar(java.lang.Object other)</pre>
|
|
<div class="block">Determine if two JSONObjects are similar.
|
|
They must contain the same set of names which must be associated with
|
|
similar values.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>other</code> - The other JSONObject</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>true if they are equal</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toJSONArray(com.intellectualcrafters.json.JSONArray)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toJSONArray</h4>
|
|
<pre>public <a href="../../../com/intellectualcrafters/json/JSONArray.html"
|
|
title="class in com.intellectualcrafters.json">JSONArray</a> toJSONArray(<a
|
|
href="../../../com/intellectualcrafters/json/JSONArray.html" title="class in com.intellectualcrafters.json">JSONArray</a> names)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Produce a JSONArray containing the values of the members of this
|
|
JSONObject.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>names</code> - A JSONArray containing a list of key strings. This determines
|
|
the sequence of the values in the result.
|
|
</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>A JSONArray of values.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If any of the values
|
|
are non-finite numbers.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toString()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toString</h4>
|
|
<pre>public java.lang.String toString()</pre>
|
|
<div class="block">Make a JSON text of this JSONObject. For compactness, no whitespace is
|
|
added. If this would not result in a syntactically correct JSON text,
|
|
then null will be returned instead.
|
|
<p/>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</div>
|
|
<dl>
|
|
<dt><strong>Overrides:</strong></dt>
|
|
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>a printable, displayable, portable, transmittable representation
|
|
of the object, beginning with <code>{</code>
|
|
<small>(left
|
|
brace)
|
|
</small>
|
|
and ending with <code>}</code>
|
|
<small>(right
|
|
brace)
|
|
</small>
|
|
.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toString(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toString</h4>
|
|
<pre>public java.lang.String toString(int indentFactor)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Make a prettyprinted JSON text of this JSONObject.
|
|
<p/>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Parameters:</span></dt>
|
|
<dd><code>indentFactor</code> - The number of spaces to add to each level of indentation.</dd>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>a printable, displayable, portable, transmittable representation
|
|
of the object, beginning with <code>{</code>
|
|
<small>(left
|
|
brace)
|
|
</small>
|
|
and ending with <code>}</code>
|
|
<small>(right
|
|
brace)
|
|
</small>
|
|
.
|
|
</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code> - If the object
|
|
contains an invalid number.
|
|
</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="write(java.io.Writer)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>write</h4>
|
|
<pre>public java.io.Writer write(java.io.Writer writer)
|
|
throws <a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></pre>
|
|
<div class="block">Write the contents of the JSONObject as JSON text to a writer. For
|
|
compactness, no whitespace is added.
|
|
<p/>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</div>
|
|
<dl>
|
|
<dt><span class="strong">Returns:</span></dt>
|
|
<dd>The writer.</dd>
|
|
<dt><span class="strong">Throws:</span></dt>
|
|
<dd><code><a href="../../../com/intellectualcrafters/json/JSONException.html"
|
|
title="class in com.intellectualcrafters.json">JSONException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a name="navbar_bottom">
|
|
<!-- -->
|
|
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../overview-summary.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../../com/intellectualcrafters/json/JSONML.html" title="class in com.intellectualcrafters.json"><span
|
|
class="strong">Prev Class</span></a></li>
|
|
<li><a href="../../../com/intellectualcrafters/json/JSONString.html"
|
|
title="interface in com.intellectualcrafters.json"><span class="strong">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../../index.html?com/intellectualcrafters/json/JSONObject.html" target="_top">Frames</a></li>
|
|
<li><a href="JSONObject.html" target="_top">No Frames</a></li>
|
|
</ul>
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if (window == top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#field_summary">Field</a> | </li>
|
|
<li><a href="#constructor_summary">Constr</a> | </li>
|
|
<li><a href="#method_summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field_detail">Field</a> | </li>
|
|
<li><a href="#constructor_detail">Constr</a> | </li>
|
|
<li><a href="#method_detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a name="skip-navbar_bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
</body>
|
|
</html>
|