mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 19:35:31 -04:00
2359 lines
120 KiB
HTML
2359 lines
120 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>JSONArray</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="JSONArray";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var methods = {"i0":10,"i1":10,"i2":10,"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":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"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":10,"i65":10,"i66":10,"i67":10,"i68":10,"i69":10,"i70":10};
|
|
var tabs = {65535:["t0","All 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/HTTPTokener.html" title="class in org.json"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../org/json/JSONException.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/JSONArray.html" target="_top">Frames</a></li>
|
|
<li><a href="JSONArray.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>Field | </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>Field | </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 JSONArray" class="title">Class JSONArray</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.JSONArray</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl>
|
|
<dt>All Implemented Interfaces:</dt>
|
|
<dd><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</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>></dd>
|
|
</dl>
|
|
<hr>
|
|
<br>
|
|
<pre>public class <span class="typeNameLabel">JSONArray</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>
|
|
implements <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</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>></pre>
|
|
<div class="block">A JSONArray is an ordered sequence of values. Its external text form is a
|
|
string wrapped in square brackets with commas separating the values. The
|
|
internal form is an object having <code>get</code> and <code>opt</code>
|
|
methods for accessing the values by index, and <code>put</code> methods for
|
|
adding or replacing values. 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 object</code>.
|
|
<p>
|
|
The constructor can convert a JSON text into a Java object. The
|
|
<code>toString</code> method converts to JSON text.
|
|
<p>
|
|
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.
|
|
<p>
|
|
The texts produced by the <code>toString</code> methods strictly conform to
|
|
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 bracket.</li>
|
|
<li>The <code>null</code> value will be inserted when there is <code>,</code>
|
|
<small>(comma)</small> elision.</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">
|
|
<!-- ======== 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="colOne" scope="col">Constructor and Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray--">JSONArray</a></span>()</code>
|
|
<div class="block">Construct an empty JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-java.util.Collection-">JSONArray</a></span>(<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><?> collection)</code>
|
|
<div class="block">Construct a JSONArray from a Collection.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-int-">JSONArray</a></span>(int initialCapacity)</code>
|
|
<div class="block">Construct a JSONArray with the specified initial capacity.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-java.lang.Iterable-">JSONArray</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a><?> iter)</code>
|
|
<div class="block">Construct a JSONArray from an Iterable.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-org.json.JSONArray-">JSONArray</a></span>(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> array)</code>
|
|
<div class="block">Construct a JSONArray from another JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-org.json.JSONTokener-">JSONArray</a></span>(<a href="../../org/json/JSONTokener.html" title="class in org.json">JSONTokener</a> x)</code>
|
|
<div class="block">Construct a JSONArray from a JSONTokener.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-java.lang.Object-">JSONArray</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> array)</code>
|
|
<div class="block">Construct a JSONArray from an array.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colOne"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#JSONArray-java.lang.String-">JSONArray</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 JSONArray from a source JSON text.</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="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="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/JSONArray.html#get-int-">get</a></span>(int index)</code>
|
|
<div class="block">Get the object value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" 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/JSONArray.html#getBigDecimal-int-">getBigDecimal</a></span>(int index)</code>
|
|
<div class="block">Get the BigDecimal value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" 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/JSONArray.html#getBigInteger-int-">getBigInteger</a></span>(int index)</code>
|
|
<div class="block">Get the BigInteger value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#getBoolean-int-">getBoolean</a></span>(int index)</code>
|
|
<div class="block">Get the boolean value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#getDouble-int-">getDouble</a></span>(int index)</code>
|
|
<div class="block">Get the double value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i5" 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/JSONArray.html#getEnum-java.lang.Class-int-">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,
|
|
int index)</code>
|
|
<div class="block">Get the enum value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#getFloat-int-">getFloat</a></span>(int index)</code>
|
|
<div class="block">Get the float value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#getInt-int-">getInt</a></span>(int index)</code>
|
|
<div class="block">Get the int value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i8" 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/JSONArray.html#getJSONArray-int-">getJSONArray</a></span>(int index)</code>
|
|
<div class="block">Get the JSONArray associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i9" 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/JSONArray.html#getJSONObject-int-">getJSONObject</a></span>(int index)</code>
|
|
<div class="block">Get the JSONObject associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i10" class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#getLong-int-">getLong</a></span>(int index)</code>
|
|
<div class="block">Get the long value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i11" 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/JSONArray.html#getNumber-int-">getNumber</a></span>(int index)</code>
|
|
<div class="block">Get the Number value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i12" 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/JSONArray.html#getString-int-">getString</a></span>(int index)</code>
|
|
<div class="block">Get the string associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i13" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#isEmpty--">isEmpty</a></span>()</code>
|
|
<div class="block">Check if JSONArray is empty.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i14" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#isNull-int-">isNull</a></span>(int index)</code>
|
|
<div class="block">Determine if the value is <code>null</code>.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i15" class="rowColor">
|
|
<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/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/JSONArray.html#iterator--">iterator</a></span>()</code> </td>
|
|
</tr>
|
|
<tr id="i16" 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/JSONArray.html#join-java.lang.String-">join</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> separator)</code>
|
|
<div class="block">Make a string from the contents of this JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i17" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#length--">length</a></span>()</code>
|
|
<div class="block">Get the number of elements in the JSONArray, included nulls.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i18" 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/JSONArray.html#opt-int-">opt</a></span>(int index)</code>
|
|
<div class="block">Get the optional object value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i19" 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/JSONArray.html#optBigDecimal-int-java.math.BigDecimal-">optBigDecimal</a></span>(int index,
|
|
<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 the optional BigDecimal value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i20" 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/JSONArray.html#optBigInteger-int-java.math.BigInteger-">optBigInteger</a></span>(int index,
|
|
<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 the optional BigInteger value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i21" class="rowColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optBoolean-int-">optBoolean</a></span>(int index)</code>
|
|
<div class="block">Get the optional boolean value associated with an index.</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/JSONArray.html#optBoolean-int-boolean-">optBoolean</a></span>(int index,
|
|
boolean defaultValue)</code>
|
|
<div class="block">Get the optional boolean value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i23" class="rowColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optDouble-int-">optDouble</a></span>(int index)</code>
|
|
<div class="block">Get the optional double value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i24" class="altColor">
|
|
<td class="colFirst"><code>double</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optDouble-int-double-">optDouble</a></span>(int index,
|
|
double defaultValue)</code>
|
|
<div class="block">Get the optional double value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i25" 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/JSONArray.html#optEnum-java.lang.Class-int-">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,
|
|
int index)</code>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i26" 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/JSONArray.html#optEnum-java.lang.Class-int-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,
|
|
int index,
|
|
E defaultValue)</code>
|
|
<div class="block">Get the enum value associated with a key.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i27" class="rowColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optFloat-int-">optFloat</a></span>(int index)</code>
|
|
<div class="block">Get the optional float value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i28" class="altColor">
|
|
<td class="colFirst"><code>float</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optFloat-int-float-">optFloat</a></span>(int index,
|
|
float defaultValue)</code>
|
|
<div class="block">Get the optional float value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i29" class="rowColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optInt-int-">optInt</a></span>(int index)</code>
|
|
<div class="block">Get the optional int value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i30" class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optInt-int-int-">optInt</a></span>(int index,
|
|
int defaultValue)</code>
|
|
<div class="block">Get the optional int value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i31" 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/JSONArray.html#optJSONArray-int-">optJSONArray</a></span>(int index)</code>
|
|
<div class="block">Get the optional JSONArray associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i32" 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/JSONArray.html#optJSONObject-int-">optJSONObject</a></span>(int index)</code>
|
|
<div class="block">Get the optional JSONObject associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i33" class="rowColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optLong-int-">optLong</a></span>(int index)</code>
|
|
<div class="block">Get the optional long value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i34" class="altColor">
|
|
<td class="colFirst"><code>long</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.html#optLong-int-long-">optLong</a></span>(int index,
|
|
long defaultValue)</code>
|
|
<div class="block">Get the optional long value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i35" 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/JSONArray.html#optNumber-int-">optNumber</a></span>(int index)</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="i36" 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/JSONArray.html#optNumber-int-java.lang.Number-">optNumber</a></span>(int index,
|
|
<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="i37" 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/JSONArray.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="i38" 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/JSONArray.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="i39" 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/JSONArray.html#optString-int-">optString</a></span>(int index)</code>
|
|
<div class="block">Get the optional string value associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i40" 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/JSONArray.html#optString-int-java.lang.String-">optString</a></span>(int index,
|
|
<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 the optional string associated with an index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i41" 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/JSONArray.html#put-boolean-">put</a></span>(boolean value)</code>
|
|
<div class="block">Append a boolean value.</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/JSONArray.html#put-java.util.Collection-">put</a></span>(<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 value in the JSONArray, where the value will be a JSONArray which
|
|
is produced from a Collection.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i43" 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/JSONArray.html#put-double-">put</a></span>(double value)</code>
|
|
<div class="block">Append a double value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i44" 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/JSONArray.html#put-float-">put</a></span>(float value)</code>
|
|
<div class="block">Append a float value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i45" 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/JSONArray.html#put-int-">put</a></span>(int value)</code>
|
|
<div class="block">Append an int value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i46" 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/JSONArray.html#put-int-boolean-">put</a></span>(int index,
|
|
boolean value)</code>
|
|
<div class="block">Put or replace a boolean value in the JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i47" 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/JSONArray.html#put-int-java.util.Collection-">put</a></span>(int index,
|
|
<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 value in the JSONArray, where the value will be a JSONArray which
|
|
is produced from a Collection.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i48" 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/JSONArray.html#put-int-double-">put</a></span>(int index,
|
|
double value)</code>
|
|
<div class="block">Put or replace a double value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i49" 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/JSONArray.html#put-int-float-">put</a></span>(int index,
|
|
float value)</code>
|
|
<div class="block">Put or replace a float value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i50" 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/JSONArray.html#put-int-int-">put</a></span>(int index,
|
|
int value)</code>
|
|
<div class="block">Put or replace an int value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i51" 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/JSONArray.html#put-int-long-">put</a></span>(int index,
|
|
long value)</code>
|
|
<div class="block">Put or replace a long value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i52" 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/JSONArray.html#put-int-java.util.Map-">put</a></span>(int index,
|
|
<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 value in the JSONArray, where the value will be a JSONObject that
|
|
is produced from a Map.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i53" 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/JSONArray.html#put-int-java.lang.Object-">put</a></span>(int index,
|
|
<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 or replace an object value in the JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i54" 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/JSONArray.html#put-long-">put</a></span>(long value)</code>
|
|
<div class="block">Append an long value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i55" 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/JSONArray.html#put-java.util.Map-">put</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><?,?> value)</code>
|
|
<div class="block">Put a value in the JSONArray, where the value will be a JSONObject which
|
|
is produced from a Map.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i56" 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/JSONArray.html#put-java.lang.Object-">put</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">Append an object value.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i57" 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/JSONArray.html#putAll-java.util.Collection-">putAll</a></span>(<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><?> collection)</code>
|
|
<div class="block">Put a collection's elements in to the JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i58" 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/JSONArray.html#putAll-java.lang.Iterable-">putAll</a></span>(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a><?> iter)</code>
|
|
<div class="block">Put an Iterable's elements in to the JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i59" 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/JSONArray.html#putAll-org.json.JSONArray-">putAll</a></span>(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> array)</code>
|
|
<div class="block">Put a JSONArray's elements in to the JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i60" 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/JSONArray.html#putAll-java.lang.Object-">putAll</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> array)</code>
|
|
<div class="block">Put an array's elements in to the JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i61" 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/JSONArray.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 JSONArray.</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/JSONArray.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 JSONArray.</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/JSONArray.html#remove-int-">remove</a></span>(int index)</code>
|
|
<div class="block">Remove an index and close the hole.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i64" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<td class="colLast"><code><span class="memberNameLink"><a href="../../org/json/JSONArray.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 JSONArrays are similar.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i65" 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/JSONArray.html#toJSONObject-org.json.JSONArray-">toJSONObject</a></span>(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> names)</code>
|
|
<div class="block">Produce a JSONObject by combining a JSONArray of names with the values of
|
|
this JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i66" class="altColor">
|
|
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</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/JSONArray.html#toList--">toList</a></span>()</code>
|
|
<div class="block">Returns a java.util.List containing all of the elements in this array.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i67" 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/JSONArray.html#toString--">toString</a></span>()</code>
|
|
<div class="block">Make a JSON text of this JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i68" 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/JSONArray.html#toString-int-">toString</a></span>(int indentFactor)</code>
|
|
<div class="block">Make a pretty-printed JSON text of this JSONArray.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i69" 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/JSONArray.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 JSONArray as JSON text to a writer.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i70" 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/JSONArray.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 JSONArray 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>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Iterable">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from interface java.lang.<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a></h3>
|
|
<code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true#forEach-java.util.function.Consumer-" title="class or interface in java.lang">forEach</a>, <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true#spliterator--" title="class or interface in java.lang">spliterator</a></code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<ul class="blockList">
|
|
<li class="blockList"><a name="constructor.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a name="JSONArray--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray()</pre>
|
|
<div class="block">Construct an empty JSONArray.</div>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-org.json.JSONTokener-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(<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 JSONArray from a JSONTokener.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>x</code> - A JSONTokener</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.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(<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 JSONArray from a source JSON text.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>source</code> - A string that begins with <code>[</code> <small>(left
|
|
bracket)</small> and ends with <code>]</code>
|
|
<small>(right bracket)</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.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-java.util.Collection-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(<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><?> collection)</pre>
|
|
<div class="block">Construct a JSONArray from a Collection.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>collection</code> - A Collection.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-java.lang.Iterable-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a><?> iter)</pre>
|
|
<div class="block">Construct a JSONArray from an Iterable. This is a shallow copy.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>iter</code> - A Iterable collection.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-org.json.JSONArray-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> array)</pre>
|
|
<div class="block">Construct a JSONArray from another JSONArray. This is a shallow copy.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>array</code> - A array.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(<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> array)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONArray from an array.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>array</code> - Array. If the parameter passed is null, or not an array, an
|
|
exception will be thrown.</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 not an array or if an array 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> - Thrown if the array parameter is null.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="JSONArray-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>JSONArray</h4>
|
|
<pre>public JSONArray(int initialCapacity)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Construct a JSONArray with the specified initial capacity.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>initialCapacity</code> - the initial capacity of the JSONArray.</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 initial capacity is negative.</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="iterator--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>iterator</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/Object.html?is-external=true" title="class or interface in java.lang">Object</a>> iterator()</pre>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true#iterator--" title="class or interface in java.lang">iterator</a></code> in interface <code><a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</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></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="get-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the object value associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object 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 value for the index.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBoolean-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getBoolean</h4>
|
|
<pre>public boolean getBoolean(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the boolean value associated with an index. The string values "true"
|
|
and "false" are converted to boolean.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</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 there is no value for the index or if the value is not
|
|
convertible to boolean.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getDouble-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getDouble</h4>
|
|
<pre>public double getDouble(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the double value associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>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 cannot be converted
|
|
to a number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getFloat-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getFloat</h4>
|
|
<pre>public float getFloat(int index)
|
|
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>index</code> - The index must be between 0 and length() - 1.</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-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
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>index</code> - The index must be between 0 and length() - 1.</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="getEnum-java.lang.Class-int-">
|
|
<!-- -->
|
|
</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,
|
|
int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the enum value associated with an index.</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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The enum value at the index location</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="getBigDecimal-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the BigDecimal value associated with an index. 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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>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 cannot be converted
|
|
to a BigDecimal.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getBigInteger-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the BigInteger value associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>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 cannot be converted
|
|
to a BigInteger.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getInt-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getInt</h4>
|
|
<pre>public int getInt(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the int value associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>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 number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getJSONArray-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the JSONArray associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONArray 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 value for the index. or if the value is not a
|
|
JSONArray</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getJSONObject-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the JSONObject associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - subscript</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONObject 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 value for the index or if the value is not a
|
|
JSONObject</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getLong-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>getLong</h4>
|
|
<pre>public long getLong(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the long value associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>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 cannot be converted
|
|
to a number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="getString-int-">
|
|
<!-- -->
|
|
</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(int index)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Get the string associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A string 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 index.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="isNull-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isNull</h4>
|
|
<pre>public boolean isNull(int index)</pre>
|
|
<div class="block">Determine if the value is <code>null</code>.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if the value at the index is <code>null</code>, or if there is no value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="join-java.lang.String-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>join</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> join(<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> separator)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Make a string from the contents of this JSONArray. The
|
|
<code>separator</code> string is inserted between each element. Warning:
|
|
This method assumes that the data structure is acyclical.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>separator</code> - A string that will be inserted between the elements.</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 the array contains an invalid number.</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 elements in the JSONArray, included nulls.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The length (or size).</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="opt-int-">
|
|
<!-- -->
|
|
</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(int index)</pre>
|
|
<div class="block">Get the optional object value associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1. If not, null is returned.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object value, or null if there is no object at that index.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBoolean-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBoolean</h4>
|
|
<pre>public boolean optBoolean(int index)</pre>
|
|
<div class="block">Get the optional boolean value associated with an index. It returns false
|
|
if there is no value at that index, or if the value is not Boolean.TRUE
|
|
or the String "true".</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBoolean-int-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optBoolean</h4>
|
|
<pre>public boolean optBoolean(int index,
|
|
boolean defaultValue)</pre>
|
|
<div class="block">Get the optional boolean value associated with an index. It returns the
|
|
defaultValue if there is no value at that index 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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dd><code>defaultValue</code> - A boolean default.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The truth.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optDouble-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optDouble</h4>
|
|
<pre>public double optDouble(int index)</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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optDouble-int-double-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optDouble</h4>
|
|
<pre>public double optDouble(int index,
|
|
double 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>index</code> - subscript</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="optFloat-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optFloat</h4>
|
|
<pre>public float optFloat(int index)</pre>
|
|
<div class="block">Get the optional float 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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optFloat-int-float-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optFloat</h4>
|
|
<pre>public float optFloat(int index,
|
|
float defaultValue)</pre>
|
|
<div class="block">Get the optional float 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>index</code> - subscript</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-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optInt</h4>
|
|
<pre>public int optInt(int index)</pre>
|
|
<div class="block">Get the optional int value associated with an index. Zero 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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optInt-int-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optInt</h4>
|
|
<pre>public int optInt(int index,
|
|
int defaultValue)</pre>
|
|
<div class="block">Get the optional int 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>index</code> - The index must be between 0 and length() - 1.</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="optEnum-java.lang.Class-int-">
|
|
<!-- -->
|
|
</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,
|
|
int index)</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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The enum value at the index location or null if not found</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optEnum-java.lang.Class-int-java.lang.Enum-">
|
|
<!-- -->
|
|
</a><a name="optEnum-java.lang.Class-int-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,
|
|
int index,
|
|
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>index</code> - The index must be between 0 and length() - 1.</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 at the index location or defaultValue if
|
|
the value is not found or cannot be assigned to clazz</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optBigInteger-int-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(int index,
|
|
<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 the optional BigInteger 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>index</code> - The index must be between 0 and length() - 1.</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="optBigDecimal-int-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(int index,
|
|
<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 the optional BigDecimal 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. 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>index</code> - The index must be between 0 and length() - 1.</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="optJSONArray-int-">
|
|
<!-- -->
|
|
</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(int index)</pre>
|
|
<div class="block">Get the optional JSONArray associated with an index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - subscript</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONArray value, or null if the index has no value, or if the
|
|
value is not a JSONArray.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optJSONObject-int-">
|
|
<!-- -->
|
|
</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(int index)</pre>
|
|
<div class="block">Get the optional JSONObject associated with an index. Null is returned if
|
|
the key is not found, or null if the index has no value, or if the value
|
|
is not a JSONObject.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONObject value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optLong-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optLong</h4>
|
|
<pre>public long optLong(int index)</pre>
|
|
<div class="block">Get the optional long value associated with an index. Zero 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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optLong-int-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>optLong</h4>
|
|
<pre>public long optLong(int index,
|
|
long defaultValue)</pre>
|
|
<div class="block">Get the optional long 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>index</code> - The index must be between 0 and length() - 1.</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="optNumber-int-">
|
|
<!-- -->
|
|
</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(int index)</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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>An object which is the value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optNumber-int-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(int index,
|
|
<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 (<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>index</code> - The index must be between 0 and length() - 1.</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-int-">
|
|
<!-- -->
|
|
</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(int index)</pre>
|
|
<div class="block">Get the optional string value associated with an index. It returns an
|
|
empty string if there is no value at that index. 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>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A String value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="optString-int-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(int index,
|
|
<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 the optional string associated with an index. The defaultValue is
|
|
returned if the key is not found.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index must be between 0 and length() - 1.</dd>
|
|
<dd><code>defaultValue</code> - The default value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A String value.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(boolean value)</pre>
|
|
<div class="block">Append a boolean value. This increases the array's length by one.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - A boolean value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-java.util.Collection-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(<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)</pre>
|
|
<div class="block">Put a value in the JSONArray, where the value will be a JSONArray which
|
|
is produced from a Collection.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<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>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-double-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(double value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Append a double value. This increases the array's length by one.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - A double 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 not finite.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-float-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(float value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Append a float value. This increases the array's length by one.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - A float 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 not finite.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int value)</pre>
|
|
<div class="block">Append an int value. This increases the array's length by one.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - An int value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(long value)</pre>
|
|
<div class="block">Append an long value. This increases the array's length by one.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - A long value.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-java.util.Map-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(<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)</pre>
|
|
<div class="block">Put a value in the JSONArray, where the value will be a JSONObject which
|
|
is produced from a Map.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<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 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="put-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(<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)</pre>
|
|
<div class="block">Append an object value. This increases the array's length by one.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>value</code> - An object value. The value should be a Boolean, Double,
|
|
Integer, JSONArray, JSONObject, Long, or 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>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-boolean-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
boolean value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put or replace a boolean value in the JSONArray. If the index is greater
|
|
than the length of the JSONArray, then null elements will be added as
|
|
necessary to pad it out.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - A boolean 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 index is negative.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-java.util.Collection-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
<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 value in the JSONArray, where the value will be a JSONArray which
|
|
is produced from a Collection.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</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 index is negative or if the value is non-finite.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-double-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
double value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put or replace a double value. If the index is greater than the length of
|
|
the JSONArray, then null elements will be added as necessary to pad it
|
|
out.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - A double 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 index is negative or if the value is non-finite.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-float-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
float value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put or replace a float value. If the index is greater than the length of
|
|
the JSONArray, then null elements will be added as necessary to pad it
|
|
out.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - A float 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 index is negative or if the value is non-finite.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-int-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
int value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put or replace an int value. If the index is greater than the length of
|
|
the JSONArray, then null elements will be added as necessary to pad it
|
|
out.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - An int 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 index is negative.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-long-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
long value)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put or replace a long value. If the index is greater than the length of
|
|
the JSONArray, then null elements will be added as necessary to pad it
|
|
out.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - A long 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 index is negative.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="put-int-java.util.Map-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
<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 value in the JSONArray, where the value will be a JSONObject that
|
|
is produced from a Map.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - The 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 index is negative or if the the value is an invalid
|
|
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="put-int-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>put</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> put(int index,
|
|
<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 or replace an object value in the JSONArray. If the index is greater
|
|
than the length of the JSONArray, then null elements will be added as
|
|
necessary to pad it out.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The subscript.</dd>
|
|
<dd><code>value</code> - The value to put into the array. The value should be a
|
|
Boolean, Double, Integer, JSONArray, JSONObject, Long, or
|
|
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 index is negative or if the the value is an invalid
|
|
number.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="putAll-java.util.Collection-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>putAll</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> putAll(<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><?> collection)</pre>
|
|
<div class="block">Put a collection's elements in to the JSONArray.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>collection</code> - A Collection.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="putAll-java.lang.Iterable-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>putAll</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> putAll(<a href="https://docs.oracle.com/javase/7/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</a><?> iter)</pre>
|
|
<div class="block">Put an Iterable's elements in to the JSONArray.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>iter</code> - An Iterable.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="putAll-org.json.JSONArray-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>putAll</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> putAll(<a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> array)</pre>
|
|
<div class="block">Put a JSONArray's elements in to the JSONArray.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>array</code> - A JSONArray.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>this.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="putAll-java.lang.Object-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>putAll</h4>
|
|
<pre>public <a href="../../org/json/JSONArray.html" title="class in org.json">JSONArray</a> putAll(<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> array)
|
|
throws <a href="../../org/json/JSONException.html" title="class in org.json">JSONException</a></pre>
|
|
<div class="block">Put an array's elements in to the JSONArray.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>array</code> - Array. If the parameter passed is null, or not an array or Iterable, an
|
|
exception will be thrown.</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 not an array, JSONArray, Iterable or if an 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> - Thrown if the array parameter is null.</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 JSONArray. For example, given a
|
|
JSONArray initialized with this document:
|
|
<pre>
|
|
[
|
|
{"b":"c"}
|
|
]
|
|
</pre>
|
|
and this JSONPointer string:
|
|
<pre>
|
|
"/0/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 JSONArray. For example, given a
|
|
JSONArray initialized with this document:
|
|
<pre>
|
|
[
|
|
{"b":"c"}
|
|
]
|
|
</pre>
|
|
and this JSONPointer:
|
|
<pre>
|
|
"/0/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="remove-int-">
|
|
<!-- -->
|
|
</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(int index)</pre>
|
|
<div class="block">Remove an index and close the hole.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - The index of the element to be removed.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The value that was associated with the index, 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 JSONArrays are similar.
|
|
They must contain similar sequences.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>other</code> - The other JSONArray</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if they are equal</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toJSONObject-org.json.JSONArray-">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toJSONObject</h4>
|
|
<pre>public <a href="../../org/json/JSONObject.html" title="class in org.json">JSONObject</a> toJSONObject(<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 JSONObject by combining a JSONArray of names with the values of
|
|
this JSONArray.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>names</code> - A JSONArray containing a list of key strings. These will be
|
|
paired with the values.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>A JSONObject, or null if there are no names or if this JSONArray
|
|
has no 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 names are null.</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 JSONArray. For compactness, no unnecessary
|
|
whitespace is added. If it is not possible to produce a syntactically
|
|
correct JSON text then null will be returned instead. This could occur if
|
|
the array contains an invalid number.
|
|
<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, transmittable representation of the
|
|
array.</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 JSONArray.
|
|
|
|
<p>If <pre> <code> indentFactor > 0</code></pre> and the <a href="../../org/json/JSONArray.html" title="class in org.json"><code>JSONArray</code></a> has only
|
|
one element, then the array will be output on a single line:
|
|
<pre><code> [1]</code></pre>
|
|
|
|
<p>If an array has 2 or more elements, then it will be output across
|
|
multiple lines: <pre><code>
|
|
[
|
|
1,
|
|
"value 2",
|
|
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, transmittable representation of the
|
|
object, beginning with <code>[</code> <small>(left
|
|
bracket)</small> and ending with <code>]</code>
|
|
<small>(right bracket)</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 a called function fails</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 JSONArray 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 fails</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 JSONArray as JSON text to a writer.
|
|
|
|
<p>If <pre><code> indentFactor > 0</code></pre> and the <a href="../../org/json/JSONArray.html" title="class in org.json"><code>JSONArray</code></a> has only
|
|
one element, then the array will be output on a single line:
|
|
<pre><code> [1]</code></pre>
|
|
|
|
<p>If an array has 2 or more elements, then it will be output across
|
|
multiple lines: <pre><code>
|
|
[
|
|
1,
|
|
"value 2",
|
|
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 fails or unable to write</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="toList--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toList</h4>
|
|
<pre>public <a href="https://docs.oracle.com/javase/7/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</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>> toList()</pre>
|
|
<div class="block">Returns a java.util.List containing all of the elements in this array.
|
|
If an element in the array is a JSONArray or JSONObject it will also
|
|
be converted to a List and a Map respectively.
|
|
<p>
|
|
Warning: This method assumes that the data structure is acyclical.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>a java.util.List containing the elements of this array</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a name="isEmpty--">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>isEmpty</h4>
|
|
<pre>public boolean isEmpty()</pre>
|
|
<div class="block">Check if JSONArray is empty.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if JSONArray is empty, otherwise false.</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/HTTPTokener.html" title="class in org.json"><span class="typeNameLink">Prev Class</span></a></li>
|
|
<li><a href="../../org/json/JSONException.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/JSONArray.html" target="_top">Frames</a></li>
|
|
<li><a href="JSONArray.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>Field | </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>Field | </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>
|