mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-04 03:45:35 -04:00
2756 lines
160 KiB
HTML
2756 lines
160 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!-- NewPage -->
|
|
<html lang="en">
|
|
<head>
|
|
<!-- Generated by javadoc (1.8.0_05) on Tue Oct 06 15:22:52 CDT 2020 -->
|
|
<title>JSONObject</title>
|
|
<meta name="date" content="2020-10-06">
|
|
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
|
|
<script type="text/javascript" src="../../script.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="JSONObject";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var methods = {"i0":10,"i1":10,"i2":9,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":9,"i16":9,"i17":10,"i18":10,"i19":10,"i20":10,"i21":9,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":9,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10,"i54":10,"i55":10,"i56":10,"i57":10,"i58":10,"i59":10,"i60":10,"i61":10,"i62":10,"i63":10,"i64":9,"i65":9,"i66":10,"i67":10,"i68":9,"i69":9,"i70":9,"i71":10,"i72":10,"i73":10,"i74":10,"i75":9,"i76":9,"i77":10,"i78":10};
|
|
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a name="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../org/json/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-all.html">Index</a></li>
|
|
<li><a href="../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../org/json/JSONML.html" title="class in org.json"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../org/json/JSONPointer.html" title="class in org.json"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../index.html?org/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">org.json</div>
|
|
<h2 title="Class JSONObject" class="title">Class JSONObject</h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>org.json.JSONObject</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="typeNameLabel">JSONObject</span>
|
|
extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></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,
|
|
|
|
<pre>
|
|
myString = new JSONObject()
|
|
.put("JSON", "Hello, World!").toString();
|
|
</pre>
|
|
|
|
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="memberSummary" 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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#NULL">NULL</a></span></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="memberSummary" 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="colFirst" scope="col">Modifier</th>
|
|
<th class="colLast" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject--">JSONObject</a></span>()</code>
|
|
<div class="block">Construct an empty JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>protected </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-int-">JSONObject</a></span>(int initialCapacity)</code>
|
|
<div class="block">Constructor to specify an initial capacity of the internal map.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-org.json.JSONObject-java.lang.String...-">JSONObject</a></span>(<a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> jo,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... names)</code>
|
|
<div class="block">Construct a JSONObject from a subset of another JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-org.json.JSONTokener-">JSONObject</a></span>(<a href="../../org/json/JSONTokener.html" title="class in org.json">JSONTokener</a> x)</code>
|
|
<div class="block">Construct a JSONObject from a JSONTokener.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-java.util.Map-">JSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><?,?> m)</code>
|
|
<div class="block">Construct a JSONObject from a Map.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-java.lang.Object-">JSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> bean)</code>
|
|
<div class="block">Construct a JSONObject from an Object using bean getters.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-java.lang.Object-java.lang.String...-">JSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> object,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... names)</code>
|
|
<div class="block">Construct a JSONObject from an Object, using reflection to find the
|
|
public members.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-java.lang.String-">JSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> source)</code>
|
|
<div class="block">Construct a JSONObject from a source JSON text string.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code> </code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#JSONObject-java.lang.String-java.util.Locale-">JSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> baseName,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> 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="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colLast" scope="col">Method and Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#accumulate-java.lang.String-java.lang.Object-">accumulate</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)</code>
|
|
<div class="block">Accumulate values under a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#append-java.lang.String-java.lang.Object-">append</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)</code>
|
|
<div class="block">Append values to the array under a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#doubleToString-double-">doubleToString</a></span>(double d)</code>
|
|
<div class="block">Produce a string from a double.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#entrySet--">entrySet</a></span>()</code>
|
|
<div class="block">Get a set of entries of the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#get-java.lang.String-">get</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the value object associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i5" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getBigDecimal-java.lang.String-">getBigDecimal</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the BigDecimal value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getBigInteger-java.lang.String-">getBigInteger</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the BigInteger value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getBoolean-java.lang.String-">getBoolean</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the boolean value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i8" class="altColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getDouble-java.lang.String-">getDouble</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the double value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i9" class="rowColor">
|
|
<td class="colFirst"><code><E extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><E>><br>E</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getEnum-java.lang.Class-java.lang.String-">getEnum</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><E> clazz,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i10" class="altColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getFloat-java.lang.String-">getFloat</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the float value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i11" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getInt-java.lang.String-">getInt</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the int value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i12" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getJSONArray-java.lang.String-">getJSONArray</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the JSONArray value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i13" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getJSONObject-java.lang.String-">getJSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the JSONObject value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i14" class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getLong-java.lang.String-">getLong</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the long value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i15" class="rowColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getNames-org.json.JSONObject-">getNames</a></span>(<a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> jo)</code>
|
|
<div class="block">Get an array of field names from a JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i16" class="altColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getNames-java.lang.Object-">getNames</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> object)</code>
|
|
<div class="block">Get an array of public field names from an Object.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i17" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getNumber-java.lang.String-">getNumber</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the Number value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i18" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#getString-java.lang.String-">getString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the string associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i19" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#has-java.lang.String-">has</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Determine if the JSONObject contains a specific key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i20" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#increment-java.lang.String-">increment</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Increment a property of a JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i21" class="rowColor">
|
|
<td class="colFirst"><code>protected static boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#isDecimalNotation-java.lang.String-">isDecimalNotation</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> val)</code>
|
|
<div class="block">Tests if the value should be tried as a decimal.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i22" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#isEmpty--">isEmpty</a></span>()</code>
|
|
<div class="block">Check if JSONObject is empty.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i23" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#isNull-java.lang.String-">isNull</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Determine if the value associated with the key is <code>null</code> or if there is no
|
|
value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i24" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#keys--">keys</a></span>()</code>
|
|
<div class="block">Get an enumeration of the keys of the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i25" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#keySet--">keySet</a></span>()</code>
|
|
<div class="block">Get a set of keys of the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i26" class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#length--">length</a></span>()</code>
|
|
<div class="block">Get the number of keys stored in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i27" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#names--">names</a></span>()</code>
|
|
<div class="block">Produce a JSONArray containing the names of the elements of this
|
|
JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i28" class="altColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#numberToString-java.lang.Number-">numberToString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> number)</code>
|
|
<div class="block">Produce a string from a Number.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i29" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#opt-java.lang.String-">opt</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get an optional value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i30" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optBigDecimal-java.lang.String-java.math.BigDecimal-">optBigDecimal</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</a> defaultValue)</code>
|
|
<div class="block">Get an optional BigDecimal 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 id="i31" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optBigInteger-java.lang.String-java.math.BigInteger-">optBigInteger</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> defaultValue)</code>
|
|
<div class="block">Get an optional BigInteger 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 id="i32" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optBoolean-java.lang.String-">optBoolean</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get an optional boolean associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i33" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optBoolean-java.lang.String-boolean-">optBoolean</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
boolean defaultValue)</code>
|
|
<div class="block">Get an optional boolean associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i34" class="altColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optDouble-java.lang.String-">optDouble</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 id="i35" class="rowColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optDouble-java.lang.String-double-">optDouble</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 id="i36" class="altColor">
|
|
<td class="colFirst"><code><E extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><E>><br>E</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optEnum-java.lang.Class-java.lang.String-">optEnum</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><E> clazz,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i37" class="rowColor">
|
|
<td class="colFirst"><code><E extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><E>><br>E</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optEnum-java.lang.Class-java.lang.String-E-">optEnum</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><E> clazz,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
E defaultValue)</code>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i38" class="altColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optFloat-java.lang.String-">optFloat</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get the optional double value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i39" class="rowColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optFloat-java.lang.String-float-">optFloat</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
float defaultValue)</code>
|
|
<div class="block">Get the optional double value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i40" class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optInt-java.lang.String-">optInt</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 id="i41" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optInt-java.lang.String-int-">optInt</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 id="i42" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optJSONArray-java.lang.String-">optJSONArray</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get an optional JSONArray associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i43" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optJSONObject-java.lang.String-">optJSONObject</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get an optional JSONObject associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i44" class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optLong-java.lang.String-">optLong</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 id="i45" class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optLong-java.lang.String-long-">optLong</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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 id="i46" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optNumber-java.lang.String-">optNumber</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get an optional <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><code>Number</code></a> value associated with a key, or <code>null</code>
|
|
if there is no such key or if the value is not a number.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i47" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optNumber-java.lang.String-java.lang.Number-">optNumber</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> defaultValue)</code>
|
|
<div class="block">Get an optional <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><code>Number</code></a> 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 id="i48" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optQuery-org.json.JSONPointer-">optQuery</a></span>(<a href="../../org/json/JSONPointer.html" title="class in org.json">JSONPointer</a> jsonPointer)</code>
|
|
<div class="block">Queries and returns a value from this object using <code>jsonPointer</code>, or
|
|
returns null if the query fails due to a missing key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i49" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optQuery-java.lang.String-">optQuery</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> jsonPointer)</code>
|
|
<div class="block">Queries and returns a value from this object using <code>jsonPointer</code>, or
|
|
returns null if the query fails due to a missing key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i50" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optString-java.lang.String-">optString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Get an optional string associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i51" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#optString-java.lang.String-java.lang.String-">optString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> defaultValue)</code>
|
|
<div class="block">Get an optional string associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i52" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-boolean-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
boolean value)</code>
|
|
<div class="block">Put a key/boolean pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i53" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-java.util.Collection-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> 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 id="i54" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-double-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
double value)</code>
|
|
<div class="block">Put a key/double pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i55" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-float-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
float value)</code>
|
|
<div class="block">Put a key/float pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i56" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-int-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
int value)</code>
|
|
<div class="block">Put a key/int pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i57" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-long-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
long value)</code>
|
|
<div class="block">Put a key/long pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i58" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-java.util.Map-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><?,?> 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 id="i59" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#put-java.lang.String-java.lang.Object-">put</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)</code>
|
|
<div class="block">Put a key/value pair in the JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i60" class="altColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#putOnce-java.lang.String-java.lang.Object-">putOnce</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> 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 id="i61" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#putOpt-java.lang.String-java.lang.Object-">putOpt</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> 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 id="i62" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#query-org.json.JSONPointer-">query</a></span>(<a href="../../org/json/JSONPointer.html" title="class in org.json">JSONPointer</a> jsonPointer)</code>
|
|
<div class="block">Uses a user initialized JSONPointer and tries to
|
|
match it to an item within this JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i63" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#query-java.lang.String-">query</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> jsonPointer)</code>
|
|
<div class="block">Creates a JSONPointer using an initialization string and tries to
|
|
match it to an item within this JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i64" class="altColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#quote-java.lang.String-">quote</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> string)</code>
|
|
<div class="block">Produce a string in double quotes with backslash sequences in all the
|
|
right places.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i65" class="rowColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#quote-java.lang.String-java.io.Writer-">quote</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> string,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> w)</code> </td>
|
|
</tr>
|
|
<tr id="i66" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#remove-java.lang.String-">remove</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</code>
|
|
<div class="block">Remove a name and its value, if present.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i67" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#similar-java.lang.Object-">similar</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> other)</code>
|
|
<div class="block">Determine if two JSONObjects are similar.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i68" class="altColor">
|
|
<td class="colFirst"><code>protected static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#stringToNumber-java.lang.String-">stringToNumber</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> val)</code>
|
|
<div class="block">Converts a string to a number using the narrowest possible type.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i69" class="rowColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#stringToValue-java.lang.String-">stringToValue</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> string)</code>
|
|
<div class="block">Try to convert a string into a number, boolean, or null.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i70" class="altColor">
|
|
<td class="colFirst"><code>static void</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#testValidity-java.lang.Object-">testValidity</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</code>
|
|
<div class="block">Throw an exception if the object is a NaN or infinite number.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i71" class="rowColor">
|
|
<td class="colFirst"><code><a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#toJSONArray-org.json.JSONArray-">toJSONArray</a></span>(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> names)</code>
|
|
<div class="block">Produce a JSONArray containing the values of the members of this
|
|
JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i72" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#toMap--">toMap</a></span>()</code>
|
|
<div class="block">Returns a java.util.Map containing all of the entries in this object.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i73" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#toString--">toString</a></span>()</code>
|
|
<div class="block">Make a JSON text of this JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i74" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#toString-int-">toString</a></span>(int indentFactor)</code>
|
|
<div class="block">Make a pretty-printed JSON text of this JSONObject.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i75" class="rowColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#valueToString-java.lang.Object-">valueToString</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)</code>
|
|
<div class="block">Make a JSON text of an Object value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i76" class="altColor">
|
|
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#wrap-java.lang.Object-">wrap</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> object)</code>
|
|
<div class="block">Wrap an object, if necessary.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i77" class="rowColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#write-java.io.Writer-">write</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> writer)</code>
|
|
<div class="block">Write the contents of the JSONObject as JSON text to a writer.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i78" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a></code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONObject.html#write-java.io.Writer-int-int-">write</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> writer,
|
|
int indentFactor,
|
|
int indent)</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.<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
|
|
<code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> 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-org.json.JSONObject-java.lang.String...-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(<a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> jo,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>jo</code> - A JSONObject.</dd>
|
|
<dd><code>names</code> - An array of strings.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject-org.json.JSONTokener-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(<a href="../../org/json/JSONTokener.html" title="class in org.json">JSONTokener</a> x)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONObject from a JSONTokener.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>x</code> - A JSONTokener object containing the source string.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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(<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><?,?> m)</pre>
|
|
<div class="block">Construct a JSONObject from a Map.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>m</code> - A map object that can be used to initialize the contents of
|
|
the JSONObject.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If a value in the map is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If a key in the map is <code>null</code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> 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>
|
|
Methods that are <code>static</code>, return <code>void</code>,
|
|
have parameters, or are "bridge" methods, are ignored.
|
|
<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>.
|
|
<p>
|
|
The <a href="../../org/json/JSONPropertyName.html" title="annotation in org.json"><code>JSONPropertyName</code></a> annotation can be used on a bean getter to
|
|
override key name used in the JSONObject. For example, using the object
|
|
above with the <code>getName</code> method, if we annotated it with:
|
|
<pre>
|
|
@JSONPropertyName("FullName")
|
|
public String getName() { return this.name; }
|
|
</pre>
|
|
The resulting JSON object would contain <code>"FullName": "Larry Fine"</code>
|
|
<p>
|
|
Similarly, the <a href="../../org/json/JSONPropertyName.html" title="annotation in org.json"><code>JSONPropertyName</code></a> annotation can be used on non-
|
|
<code>get</code> and <code>is</code> methods. We can also override key
|
|
name used in the JSONObject as seen below even though the field would normally
|
|
be ignored:
|
|
<pre>
|
|
@JSONPropertyName("FullName")
|
|
public String fullName() { return this.name; }
|
|
</pre>
|
|
The resulting JSON object would contain <code>"FullName": "Larry Fine"</code>
|
|
<p>
|
|
The <a href="../../org/json/JSONPropertyIgnore.html" title="annotation in org.json"><code>JSONPropertyIgnore</code></a> annotation can be used to force the bean property
|
|
to not be serialized into JSON. If both <a href="../../org/json/JSONPropertyIgnore.html" title="annotation in org.json"><code>JSONPropertyIgnore</code></a> and
|
|
<a href="../../org/json/JSONPropertyName.html" title="annotation in org.json"><code>JSONPropertyName</code></a> are defined on the same method, a depth comparison is
|
|
performed and the one closest to the concrete class being serialized is used.
|
|
If both annotations are at the same level, then the <a href="../../org/json/JSONPropertyIgnore.html" title="annotation in org.json"><code>JSONPropertyIgnore</code></a>
|
|
annotation takes precedent and the field is not serialized.
|
|
For example, the following declaration would prevent the <code>getName</code>
|
|
method from being serialized:
|
|
<pre>
|
|
@JSONPropertyName("FullName")
|
|
@JSONPropertyIgnore
|
|
public String getName() { return this.name; }
|
|
</pre>
|
|
<p></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> object,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>... 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="paramLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> source)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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="paramLabel">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="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>public JSONObject(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> baseName,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Locale.html?is-external=true" title="class or interface in java.util">Locale</a> locale)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONObject from a ResourceBundle.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If any JSONExceptions are detected.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONObject-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>JSONObject</h4>
|
|
<pre>protected JSONObject(int initialCapacity)</pre>
|
|
<div class="block">Constructor to specify an initial capacity of the internal map. Useful for library
|
|
internal calls where we know, or at least can best guess, how big this JSONObject
|
|
will be.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>initialCapacity</code> - initial capacity of the internal map.</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="accumulate-java.lang.String-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>accumulate</h4>
|
|
<pre>public <a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> accumulate(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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.
|
|
|
|
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="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> append(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number or if the current value associated with
|
|
the key is not a JSONArray.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="doubleToString-double-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>doubleToString</h4>
|
|
<pre>public static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>d</code> - A double.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A String.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="get-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>get</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> get(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the value object associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The object associated with the key.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if the key is not found.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getEnum-java.lang.Class-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getEnum</h4>
|
|
<pre>public <E extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><E>> E getEnum(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><E> clazz,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Type Parameters:</span></dt>
|
|
<dd><code>E</code> - Enum Type</dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>clazz</code> - The type of enum to retrieve.</dd>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The enum value associated with the key</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if the key is not found or if the value cannot be converted
|
|
to an enum.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBoolean-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBoolean</h4>
|
|
<pre>public boolean getBoolean(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the boolean value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if the value is not a Boolean or the String "true" or
|
|
"false".</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBigInteger-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBigInteger</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> getBigInteger(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the BigInteger value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The numeric value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if the key is not found or if the value cannot
|
|
be converted to BigInteger.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBigDecimal-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBigDecimal</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</a> getBigDecimal(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the BigDecimal value associated with a key. If the value is float or
|
|
double, the the <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true#BigDecimal-double-" title="class or interface in java.math"><code>BigDecimal.BigDecimal(double)</code></a> constructor will
|
|
be used. See notes on the constructor for conversion issues that may
|
|
arise.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The numeric value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if the key is not found or if the value
|
|
cannot be converted to BigDecimal.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getDouble-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getDouble</h4>
|
|
<pre>public double getDouble(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the double value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The numeric value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="getFloat-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getFloat</h4>
|
|
<pre>public float getFloat(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the float value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The numeric value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="getNumber-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getNumber</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> getNumber(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the Number value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The numeric value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the int value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The integer value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> getJSONArray(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the JSONArray value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONArray which is the value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> getJSONObject(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the JSONObject value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONObject which is the value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the long value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The long value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="getNames-org.json.JSONObject-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getNames</h4>
|
|
<pre>public static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] getNames(<a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> jo)</pre>
|
|
<div class="block">Get an array of field names from a JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>jo</code> - JSON object</dd>
|
|
<dt><span class="returnLabel">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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[] getNames(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> object)</pre>
|
|
<div class="block">Get an array of public field names from an Object.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>object</code> - object to read</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An array of field names, or null if there are no names.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getString-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getString</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getString(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the string associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A string which is the value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Determine if the JSONObject contains a specific key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> increment(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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 (Integer). If there is such a property, and if it is
|
|
an Integer, Long, Double, Float, BigInteger, or BigDecimal then add one to it.
|
|
No overflow bounds checking is performed, so callers should initialize the key
|
|
prior to this call with an appropriate type that can handle the maximum expected
|
|
value.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Determine if the value associated with the key is <code>null</code> or if there is no
|
|
value.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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 <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> keys()</pre>
|
|
<div class="block">Get an enumeration of the keys of the JSONObject. Modifying this key Set will also
|
|
modify the JSONObject. Use with caution.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An iterator of the keys.</dd>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Set.html?is-external=true#iterator--" title="class or interface in java.util"><code>Set.iterator()</code></a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="keySet--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>keySet</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>> keySet()</pre>
|
|
<div class="block">Get a set of keys of the JSONObject. Modifying this key Set will also modify the
|
|
JSONObject. Use with caution.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A keySet.</dd>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true#keySet--" title="class or interface in java.util"><code>Map.keySet()</code></a></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="entrySet--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>entrySet</h4>
|
|
<pre>protected <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Set.html?is-external=true" title="class or interface in java.util">Set</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html?is-external=true" title="class or interface in java.util">Map.Entry</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>>> entrySet()</pre>
|
|
<div class="block">Get a set of entries of the JSONObject. These are raw values and may not
|
|
match what is returned by the JSONObject get* and opt* functions. Modifying
|
|
the returned EntrySet or the Entry objects contained therein will modify the
|
|
backing JSONObject. This does not return a clone or a read-only view.
|
|
|
|
Use with caution.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An Entry Set</dd>
|
|
<dt><span class="seeLabel">See Also:</span></dt>
|
|
<dd><a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true#entrySet--" title="class or interface in java.util"><code>Map.entrySet()</code></a></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="returnLabel">Returns:</span></dt>
|
|
<dd>The number of keys in the JSONObject.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="isEmpty--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isEmpty</h4>
|
|
<pre>public boolean isEmpty()</pre>
|
|
<div class="block">Check if JSONObject is empty.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if JSONObject is empty, otherwise false.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="names--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>names</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.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="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONArray containing the key strings, or null if the JSONObject
|
|
is empty.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="numberToString-java.lang.Number-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>numberToString</h4>
|
|
<pre>public static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> numberToString(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> number)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Produce a string from a Number.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>number</code> - A Number</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A String.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If n is a non-finite number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="opt-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>opt</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> opt(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Get an optional value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value, or null if there is no value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optEnum-java.lang.Class-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optEnum</h4>
|
|
<pre>public <E extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><E>> E optEnum(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><E> clazz,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Type Parameters:</span></dt>
|
|
<dd><code>E</code> - Enum Type</dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>clazz</code> - The type of enum to retrieve.</dd>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The enum value associated with the key or null if not found</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optEnum-java.lang.Class-java.lang.String-java.lang.Enum-">
|
|
<!-- -->
|
|
</a><a name="optEnum-java.lang.Class-java.lang.String-E-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optEnum</h4>
|
|
<pre>public <E extends <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><E>> E optEnum(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</a><E> clazz,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
E defaultValue)</pre>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Type Parameters:</span></dt>
|
|
<dd><code>E</code> - Enum Type</dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>clazz</code> - The type of enum to retrieve.</dd>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default in case the value is not found</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The enum value associated with the key or defaultValue
|
|
if the value is not found or cannot be assigned to <code>clazz</code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBoolean-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBoolean</h4>
|
|
<pre>public boolean optBoolean(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBigDecimal-java.lang.String-java.math.BigDecimal-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBigDecimal</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</a> optBigDecimal(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</a> defaultValue)</pre>
|
|
<div class="block">Get an optional BigDecimal 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. If the value
|
|
is float or double, then the <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true#BigDecimal-double-" title="class or interface in java.math"><code>BigDecimal.BigDecimal(double)</code></a>
|
|
constructor will be used. See notes on the constructor for conversion
|
|
issues that may arise.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBigInteger-java.lang.String-java.math.BigInteger-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBigInteger</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> optBigInteger(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> defaultValue)</pre>
|
|
<div class="block">Get an optional BigInteger 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optDouble-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optDouble</h4>
|
|
<pre>public double optDouble(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A string which is the key.</dd>
|
|
<dt><span class="returnLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optFloat-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optFloat</h4>
|
|
<pre>public float optFloat(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Get the optional double value associated with an index. NaN is returned
|
|
if there is no value for the index, or if the value is not a number and
|
|
cannot be converted to a number.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optFloat-java.lang.String-float-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optFloat</h4>
|
|
<pre>public float optFloat(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
float defaultValue)</pre>
|
|
<div class="block">Get the optional double value associated with an index. The defaultValue
|
|
is returned if there is no value for the index, or if the value is not a
|
|
number and cannot be converted to a number.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">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="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> optJSONArray(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> optJSONObject(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optNumber-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optNumber</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> optNumber(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Get an optional <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><code>Number</code></a> value associated with a key, or <code>null</code>
|
|
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 (<a href="https://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math"><code>BigDecimal</code></a>). This method
|
|
would be used in cases where type coercion of the number value is unwanted.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optNumber-java.lang.String-java.lang.Number-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optNumber</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> optNumber(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> defaultValue)</pre>
|
|
<div class="block">Get an optional <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><code>Number</code></a> 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. This method
|
|
would be used in cases where type coercion of the number value is unwanted.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> optString(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dt><span class="returnLabel">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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> optString(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>defaultValue</code> - The default.</dd>
|
|
<dt><span class="returnLabel">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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
boolean value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put a key/boolean pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a><?> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A Collection value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
double value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put a key/double pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-java.lang.String-float-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
float value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put a key/float pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A float which is the value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
int value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put a key/int pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
long value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put a key/long pair in the JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><?,?> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - A key string.</dd>
|
|
<dd><code>value</code> - A Map value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> put(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put a key/value pair in the JSONObject. If the value is <code>null</code>, then the
|
|
key will be removed from the JSONObject if it is present.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is non-finite number.</dd>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - If the key is <code>null</code>.</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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> putOnce(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - key to insert into</dd>
|
|
<dd><code>value</code> - value to insert</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> putOpt(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the value is a non-finite number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="query-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>query</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> query(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> jsonPointer)</pre>
|
|
<div class="block">Creates a JSONPointer using an initialization string and tries to
|
|
match it to an item within this JSONObject. For example, given a
|
|
JSONObject initialized with this document:
|
|
<pre>
|
|
{
|
|
"a":{"b":"c"}
|
|
}
|
|
</pre>
|
|
and this JSONPointer string:
|
|
<pre>
|
|
"/a/b"
|
|
</pre>
|
|
Then this method will return the String "c".
|
|
A JSONPointerException may be thrown from code called by this method.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>jsonPointer</code> - string that can be used to create a JSONPointer</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the item matched by the JSONPointer, otherwise null</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="query-org.json.JSONPointer-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>query</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> query(<a href="../../org/json/JSONPointer.html" title="class in org.json">JSONPointer</a> jsonPointer)</pre>
|
|
<div class="block">Uses a user initialized JSONPointer and tries to
|
|
match it to an item within this JSONObject. For example, given a
|
|
JSONObject initialized with this document:
|
|
<pre>
|
|
{
|
|
"a":{"b":"c"}
|
|
}
|
|
</pre>
|
|
and this JSONPointer:
|
|
<pre>
|
|
"/a/b"
|
|
</pre>
|
|
Then this method will return the String "c".
|
|
A JSONPointerException may be thrown from code called by this method.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>jsonPointer</code> - string that can be used to create a JSONPointer</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the item matched by the JSONPointer, otherwise null</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optQuery-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optQuery</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> optQuery(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> jsonPointer)</pre>
|
|
<div class="block">Queries and returns a value from this object using <code>jsonPointer</code>, or
|
|
returns null if the query fails due to a missing key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>jsonPointer</code> - the string representation of the JSON pointer</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the queried value or <code>null</code></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>jsonPointer</code> has invalid syntax</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optQuery-org.json.JSONPointer-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optQuery</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> optQuery(<a href="../../org/json/JSONPointer.html" title="class in org.json">JSONPointer</a> jsonPointer)</pre>
|
|
<div class="block">Queries and returns a value from this object using <code>jsonPointer</code>, or
|
|
returns null if the query fails due to a missing key.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>jsonPointer</code> - The JSON pointer</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>the queried value or <code>null</code></dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if <code>jsonPointer</code> has invalid syntax</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="quote-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>quote</h4>
|
|
<pre>public static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> quote(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>string</code> - A String</dd>
|
|
<dt><span class="returnLabel">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 <a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> quote(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> string,
|
|
<a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> w)
|
|
throws <a href="https://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
|
|
<dl>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="remove-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>remove</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> remove(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> key)</pre>
|
|
<div class="block">Remove a name and its value, if present.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>key</code> - The name to be removed.</dd>
|
|
<dt><span class="returnLabel">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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>other</code> - The other JSONObject</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if they are equal</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="isDecimalNotation-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isDecimalNotation</h4>
|
|
<pre>protected static boolean isDecimalNotation(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> val)</pre>
|
|
<div class="block">Tests if the value should be tried as a decimal. It makes no test if there are actual digits.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>val</code> - value to test</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if the string is "-0" or if it contains '.', 'e', or 'E', false otherwise.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="stringToNumber-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>stringToNumber</h4>
|
|
<pre>protected static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> stringToNumber(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> val)
|
|
throws <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NumberFormatException.html?is-external=true" title="class or interface in java.lang">NumberFormatException</a></pre>
|
|
<div class="block">Converts a string to a number using the narrowest possible type. Possible
|
|
returns for this function are BigDecimal, Double, BigInteger, Long, and Integer.
|
|
When a Double is returned, it should always be a valid Double and not NaN or +-infinity.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>val</code> - value to convert</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>Number representation of the value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NumberFormatException.html?is-external=true" title="class or interface in java.lang">NumberFormatException</a></code> - thrown if the value is not a valid number. A public
|
|
caller should catch this and wrap it in a <a href="../../org/json/JSONException.html" title="class in org.json"><code>JSONException</code></a> if applicable.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="stringToValue-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>stringToValue</h4>
|
|
<pre>public static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> stringToValue(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>string</code> - A String. can not be null.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A simple JSON value.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - Thrown if the string is null.</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(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Throw an exception if the object is a NaN or infinite number.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>o</code> - The object to test.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If o is a non-finite number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toJSONArray-org.json.JSONArray-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toJSONArray</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> toJSONArray(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> names)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Produce a JSONArray containing the values of the members of this
|
|
JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">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="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONArray of values.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> 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><b>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</b></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code> in class <code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd>
|
|
<dt><span class="returnLabel">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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> toString(int indentFactor)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Make a pretty-printed JSON text of this JSONObject.
|
|
|
|
<p>If <pre><code> indentFactor > 0</code></pre> and the <a href="../../org/json/JSONObject.html" title="class in org.json"><code>JSONObject</code></a>
|
|
has only one key, then the object will be output on a single line:
|
|
<pre><code> {"key": 1}</code></pre>
|
|
|
|
<p>If an object has 2 or more keys, then it will be output across
|
|
multiple lines: <pre><code> {
|
|
"key1": 1,
|
|
"key2": "value 2",
|
|
"key3": 3
|
|
}</code></pre>
|
|
<p><b>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</b></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>indentFactor</code> - The number of spaces to add to each level of indentation.</dd>
|
|
<dt><span class="returnLabel">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="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - If the object contains an invalid number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="valueToString-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>valueToString</h4>
|
|
<pre>public static <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> valueToString(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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>
|
|
Warning: This method assumes that the data structure is acyclical.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - The value to be serialized.</dd>
|
|
<dt><span class="returnLabel">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="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.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 <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> wrap(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> object)</pre>
|
|
<div class="block">Wrap an object, if necessary. If the object is <code>null</code>, 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="paramLabel">Parameters:</span></dt>
|
|
<dd><code>object</code> - The object to wrap</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The wrapped value</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="write-java.io.Writer-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>write</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> write(<a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> writer)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.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><b>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</b></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>writer</code> - the writer object</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The writer.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if a called function has an error</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="write-java.io.Writer-int-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>write</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> write(<a href="https://docs.oracle.com/javase/7/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io">Writer</a> writer,
|
|
int indentFactor,
|
|
int indent)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Write the contents of the JSONObject as JSON text to a writer.
|
|
|
|
<p>If <pre><code> indentFactor > 0</code></pre> and the <a href="../../org/json/JSONObject.html" title="class in org.json"><code>JSONObject</code></a>
|
|
has only one key, then the object will be output on a single line:
|
|
<pre><code> {"key": 1}</code></pre>
|
|
|
|
<p>If an object has 2 or more keys, then it will be output across
|
|
multiple lines: <pre><code> {
|
|
"key1": 1,
|
|
"key2": "value 2",
|
|
"key3": 3
|
|
}</code></pre>
|
|
<p><b>
|
|
Warning: This method assumes that the data structure is acyclical.
|
|
</b></div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>writer</code> - Writes the serialized JSON</dd>
|
|
<dd><code>indentFactor</code> - The number of spaces to add to each level of indentation.</dd>
|
|
<dd><code>indent</code> - The indentation of the top level.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The writer.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></code> - if a called function has an error or a write error
|
|
occurs</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toMap--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>toMap</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> toMap()</pre>
|
|
<div class="block">Returns a java.util.Map containing all of the entries in this object.
|
|
If an entry in the object is a JSONArray or JSONObject it will also
|
|
be converted.
|
|
<p>
|
|
Warning: This method assumes that the data structure is acyclical.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>a java.util.Map containing the entries of this object</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>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a name="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../org/json/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-all.html">Index</a></li>
|
|
<li><a href="../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList">
|
|
<li><a href="../../org/json/JSONML.html" title="class in org.json"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../org/json/JSONPointer.html" title="class in org.json"><span class="typeNameLink">Next Class</span></a></li>
|
|
</ul>
|
|
<ul class="navList">
|
|
<li><a href="../../index.html?org/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>
|