blob: 89ac2c48e748abeaddf850a53af6129bca9a77ec [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.11) on Mon Jun 14 16:44:01 EDT 2021 -->
<title>JSON (Eclipse Jetty API Doc - v11.0.5)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2021-06-14">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JSON (Eclipse Jetty API Doc - v11.0.5)";
}
}
catch(err) {
}
//-->
var data = {"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":9,"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};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = true;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/JSON.html">Use</a></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" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">org.eclipse.jetty.util.ajax</a></div>
<h2 title="Class JSON" class="title">Class JSON</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li>org.eclipse.jetty.util.ajax.JSON</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<pre>public class <span class="typeNameLabel">JSON</span>
extends java.lang.Object</pre>
<div class="block"><p>JSON parser and generator.</p>
<p>This class provides methods to convert POJOs to and from JSON notation.</p>
<p>The mapping from JSON to Java is:</p>
<pre>
object --&gt; Map&lt;String, Object&gt;
array --&gt; Object[]
number --&gt; Double or Long
string --&gt; String
null --&gt; null
bool --&gt; Boolean
</pre>
<p>The Java to JSON mapping is:</p>
<pre>
String --&gt; string
Number --&gt; number
Map --&gt; object
List --&gt; array
Array --&gt; array
null --&gt; null
Boolean--&gt; boolean
Object --&gt; string (dubious!)
</pre>
<p>The interface <a href="JSON.Convertible.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertible</code></a> may be implemented by classes that
wish to externalize and initialize specific fields to and from JSON objects.
Only directed acyclic graphs of objects are supported.</p>
<p>The interface <a href="JSON.Generator.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Generator</code></a> may be implemented by classes that
know how to render themselves as JSON and the <a href="#toJSON(java.lang.Object)"><code>toJSON(Object)</code></a> method
will use <a href="JSON.Generator.html#addJSON(java.lang.Appendable)"><code>JSON.Generator.addJSON(Appendable)</code></a> to generate the JSON.</p>
<p>The class <a href="JSON.Literal.html" title="class in org.eclipse.jetty.util.ajax"><code>JSON.Literal</code></a> may be used to hold pre-generated JSON object.</p>
<p>The interface <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> may be implemented to provide
converters for objects that may be registered with
<a href="#addConvertor(java.lang.Class,org.eclipse.jetty.util.ajax.JSON.Convertor)"><code>addConvertor(Class, Convertor)</code></a>.
These converters are looked up by class, interface and super class by
<a href="#getConvertor(java.lang.Class)"><code>getConvertor(Class)</code></a>.</p>
<p>If a JSON object has a <code>class</code> field, then a Java class for that
name is loaded and the method <a href="#convertTo(java.lang.Class,java.util.Map)"><code>convertTo(Class, Map)</code></a> is used to find
a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for that class.</p>
<p>If a JSON object has a <code>x-class</code> field then a direct lookup for a
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for that class name is done (without loading the class).</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.Convertible.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertible</a></span></code></th>
<td class="colLast">
<div class="block">JSON Convertible object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a></span></code></th>
<td class="colLast">
<div class="block">JSON Convertor.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.Generator.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Generator</a></span></code></th>
<td class="colLast">
<div class="block">JSON Generator.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.Literal.html" title="class in org.eclipse.jetty.util.ajax">JSON.Literal</a></span></code></th>
<td class="colLast">
<div class="block">A Literal JSON generator.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.Output.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Output</a></span></code></th>
<td class="colLast">
<div class="block">JSON Output class for use by <a href="JSON.Convertible.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertible</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.ReaderSource.html" title="class in org.eclipse.jetty.util.ajax">JSON.ReaderSource</a></span></code></th>
<td class="colLast">
<div class="block">A Reader source for a JSON string.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a></span></code></th>
<td class="colLast">
<div class="block">A generic source for a JSON representation.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="JSON.StringSource.html" title="class in org.eclipse.jetty.util.ajax">JSON.StringSource</a></span></code></th>
<td class="colLast">
<div class="block">An in-memory source for a JSON string.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">JSON</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addConvertor(java.lang.Class,org.eclipse.jetty.util.ajax.JSON.Convertor)">addConvertor</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;forClass,
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;convertor)</code></th>
<td class="colLast">
<div class="block">Registers a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for the given class.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addConvertorFor(java.lang.String,org.eclipse.jetty.util.ajax.JSON.Convertor)">addConvertorFor</a></span>&#8203;(java.lang.String&nbsp;name,
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;convertor)</code></th>
<td class="colLast">
<div class="block">Registers a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for a named class.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#append(java.lang.Appendable,java.lang.Object)">append</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Object&nbsp;object)</code></th>
<td class="colLast">
<div class="block">Appends the given object as JSON to string buffer.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendArray(java.lang.Appendable,java.lang.Object)">appendArray</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Object&nbsp;array)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendArray(java.lang.Appendable,java.util.Collection)">appendArray</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.util.Collection&lt;?&gt;&nbsp;collection)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendBoolean(java.lang.Appendable,java.lang.Boolean)">appendBoolean</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Boolean&nbsp;b)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendJSON(java.lang.Appendable,org.eclipse.jetty.util.ajax.JSON.Convertible)">appendJSON</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
<a href="JSON.Convertible.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertible</a>&nbsp;converter)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendJSON(java.lang.Appendable,org.eclipse.jetty.util.ajax.JSON.Convertor,java.lang.Object)">appendJSON</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;convertor,
java.lang.Object&nbsp;object)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendJSON(java.lang.Appendable,org.eclipse.jetty.util.ajax.JSON.Generator)">appendJSON</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
<a href="JSON.Generator.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Generator</a>&nbsp;generator)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendMap(java.lang.Appendable,java.util.Map)">appendMap</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.util.Map&lt;?,&#8203;?&gt;&nbsp;map)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendNull(java.lang.Appendable)">appendNull</a></span>&#8203;(java.lang.Appendable&nbsp;buffer)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendNumber(java.lang.Appendable,java.lang.Number)">appendNumber</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Number&nbsp;number)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#appendString(java.lang.Appendable,java.lang.String)">appendString</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.String&nbsp;string)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>protected static void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#complete(java.lang.String,org.eclipse.jetty.util.ajax.JSON.Source)">complete</a></span>&#8203;(java.lang.String&nbsp;seek,
<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>protected <a href="JSON.html" title="class in org.eclipse.jetty.util.ajax">JSON</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#contextFor(java.lang.String)">contextFor</a></span>&#8203;(java.lang.String&nbsp;field)</code></th>
<td class="colLast">
<div class="block">Every time a JSON object field representation <code>{"name": value}</code> is parsed,
this method is called to (possibly) return a different JSON instance (for example
configured with different converters) to parse the object field.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>protected <a href="JSON.html" title="class in org.eclipse.jetty.util.ajax">JSON</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#contextForArray()">contextForArray</a></span>()</code></th>
<td class="colLast">
<div class="block">Every time a JSON array representation <code>[...]</code> is parsed, this method is called
to (possibly) return a different JSON instance (for example configured with different
converters) to parse the array items.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>protected java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#convertTo(java.lang.Class,java.util.Map)">convertTo</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;type,
java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;&nbsp;map)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#escapeString(java.lang.Appendable,java.lang.String)">escapeString</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.String&nbsp;input)</code></th>
<td class="colLast">
<div class="block">Escapes the characters of the given <code>input</code> string into the given buffer.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#escapeUnicode(java.lang.Appendable,char)">escapeUnicode</a></span>&#8203;(java.lang.Appendable&nbsp;buffer,
char&nbsp;c)</code></th>
<td class="colLast">
<div class="block">Per JSON specification, unicode characters are by default NOT escaped.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fromJSON(java.io.Reader)">fromJSON</a></span>&#8203;(java.io.Reader&nbsp;reader)</code></th>
<td class="colLast">
<div class="block">Parses the JSON from the given Reader into an object.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#fromJSON(java.lang.String)">fromJSON</a></span>&#8203;(java.lang.String&nbsp;string)</code></th>
<td class="colLast">
<div class="block">Parses the given JSON string into an object.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>protected <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getConvertor(java.lang.Class)">getConvertor</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;forClass)</code></th>
<td class="colLast">
<div class="block">Looks up a convertor for a class.</div>
</td>
</tr>
<tr id="i22" class="altColor">
<td class="colFirst"><code><a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getConvertorFor(java.lang.String)">getConvertorFor</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Looks up a convertor for a class name.</div>
</td>
</tr>
<tr id="i23" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getStringBufferSize()">getStringBufferSize</a></span>()</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i24" class="altColor">
<td class="colFirst"><code>protected java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#handleUnknown(org.eclipse.jetty.util.ajax.JSON.Source,char)">handleUnknown</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source,
char&nbsp;c)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i25" class="rowColor">
<td class="colFirst"><code>protected java.lang.Object[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newArray(int)">newArray</a></span>&#8203;(int&nbsp;size)</code></th>
<td class="colLast">
<div class="block">Factory method that creates an array when a JSON representation of <code>[...]</code> is parsed.</div>
</td>
</tr>
<tr id="i26" class="altColor">
<td class="colFirst"><code>protected java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#newMap()">newMap</a></span>()</code></th>
<td class="colLast">
<div class="block">Factory method that creates a Map when a JSON representation of <code>{...}</code> is parsed.</div>
</td>
</tr>
<tr id="i27" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parse(org.eclipse.jetty.util.ajax.JSON.Source)">parse</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">
<div class="block">Parses the given JSON source into an object.</div>
</td>
</tr>
<tr id="i28" class="altColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parse(org.eclipse.jetty.util.ajax.JSON.Source,boolean)">parse</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source,
boolean&nbsp;stripOuterComment)</code></th>
<td class="colLast">
<div class="block">Parses the given JSON source into an object.</div>
</td>
</tr>
<tr id="i29" class="rowColor">
<td class="colFirst"><code>protected java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseArray(org.eclipse.jetty.util.ajax.JSON.Source)">parseArray</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i30" class="altColor">
<td class="colFirst"><code>java.lang.Number</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseNumber(org.eclipse.jetty.util.ajax.JSON.Source)">parseNumber</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i31" class="rowColor">
<td class="colFirst"><code>protected java.lang.Object</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseObject(org.eclipse.jetty.util.ajax.JSON.Source)">parseObject</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i32" class="altColor">
<td class="colFirst"><code>protected java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#parseString(org.eclipse.jetty.util.ajax.JSON.Source)">parseString</a></span>&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i33" class="rowColor">
<td class="colFirst"><code><a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#removeConvertor(java.lang.Class)">removeConvertor</a></span>&#8203;(java.lang.Class&lt;?&gt;&nbsp;forClass)</code></th>
<td class="colLast">
<div class="block">Unregisters a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for a class.</div>
</td>
</tr>
<tr id="i34" class="altColor">
<td class="colFirst"><code><a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#removeConvertorFor(java.lang.String)">removeConvertorFor</a></span>&#8203;(java.lang.String&nbsp;name)</code></th>
<td class="colLast">
<div class="block">Unregisters a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for a named class.</div>
</td>
</tr>
<tr id="i35" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#seekTo(char,org.eclipse.jetty.util.ajax.JSON.Source)">seekTo</a></span>&#8203;(char&nbsp;seek,
<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i36" class="altColor">
<td class="colFirst"><code>protected char</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#seekTo(java.lang.String,org.eclipse.jetty.util.ajax.JSON.Source)">seekTo</a></span>&#8203;(java.lang.String&nbsp;seek,
<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i37" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setStringBufferSize(int)">setStringBufferSize</a></span>&#8203;(int&nbsp;stringBufferSize)</code></th>
<td class="colLast">&nbsp;</td>
</tr>
<tr id="i38" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toJSON(java.lang.Object)">toJSON</a></span>&#8203;(java.lang.Object&nbsp;object)</code></th>
<td class="colLast">
<div class="block">Converts any object to JSON.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>JSON</h4>
<pre>public&nbsp;JSON()</pre>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="getStringBufferSize()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStringBufferSize</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;getStringBufferSize()</pre>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the initial stringBuffer size to use when creating JSON strings
(default 1024)</dd>
</dl>
</li>
</ul>
<a id="setStringBufferSize(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStringBufferSize</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;setStringBufferSize&#8203;(int&nbsp;stringBufferSize)</pre>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>stringBufferSize</code> - the initial stringBuffer size to use when creating JSON
strings (default 1024)</dd>
</dl>
</li>
</ul>
<a id="escapeString(java.lang.Appendable,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>escapeString</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;escapeString&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.String&nbsp;input)
throws java.io.IOException</pre>
<div class="block"><p>Escapes the characters of the given <code>input</code> string into the given buffer.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to escape the string into</dd>
<dd><code>input</code> - the string to escape</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code> - if appending to the buffer fails</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#escapeUnicode(java.lang.Appendable,char)"><code>escapeUnicode(Appendable, char)</code></a></dd>
</dl>
</li>
</ul>
<a id="escapeUnicode(java.lang.Appendable,char)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>escapeUnicode</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;escapeUnicode&#8203;(java.lang.Appendable&nbsp;buffer,
char&nbsp;c)
throws java.io.IOException</pre>
<div class="block"><p>Per JSON specification, unicode characters are by default NOT escaped.</p>
<p>Overriding this method allows for alternate behavior to escape those
with your choice of encoding.</p>
<pre>
protected void escapeUnicode(Appendable buffer, char c) throws IOException
{
// Unicode is backslash-u escaped
buffer.append(String.format("\\u%04x", (int)c));
}
</pre></div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.io.IOException</code></dd>
</dl>
</li>
</ul>
<a id="toJSON(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toJSON</h4>
<pre class="methodSignature">public&nbsp;java.lang.String&nbsp;toJSON&#8203;(java.lang.Object&nbsp;object)</pre>
<div class="block"><p>Converts any object to JSON.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>object</code> - the object to convert</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the JSON string representation of the object</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="#append(java.lang.Appendable,java.lang.Object)"><code>append(Appendable, Object)</code></a></dd>
</dl>
</li>
</ul>
<a id="append(java.lang.Appendable,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>append</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;append&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Object&nbsp;object)</pre>
<div class="block"><p>Appends the given object as JSON to string buffer.</p>
<p>This method tests the given object type and calls other
appends methods for each object type, see for example
<a href="#appendMap(java.lang.Appendable,java.util.Map)"><code>appendMap(Appendable, Map)</code></a>.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - the buffer to append to</dd>
<dd><code>object</code> - the object to convert to JSON</dd>
</dl>
</li>
</ul>
<a id="appendNull(java.lang.Appendable)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendNull</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendNull&#8203;(java.lang.Appendable&nbsp;buffer)</pre>
</li>
</ul>
<a id="appendJSON(java.lang.Appendable,org.eclipse.jetty.util.ajax.JSON.Convertor,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendJSON</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendJSON&#8203;(java.lang.Appendable&nbsp;buffer,
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;convertor,
java.lang.Object&nbsp;object)</pre>
</li>
</ul>
<a id="appendJSON(java.lang.Appendable,org.eclipse.jetty.util.ajax.JSON.Convertible)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendJSON</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendJSON&#8203;(java.lang.Appendable&nbsp;buffer,
<a href="JSON.Convertible.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertible</a>&nbsp;converter)</pre>
</li>
</ul>
<a id="appendJSON(java.lang.Appendable,org.eclipse.jetty.util.ajax.JSON.Generator)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendJSON</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendJSON&#8203;(java.lang.Appendable&nbsp;buffer,
<a href="JSON.Generator.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Generator</a>&nbsp;generator)</pre>
</li>
</ul>
<a id="appendMap(java.lang.Appendable,java.util.Map)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendMap</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendMap&#8203;(java.lang.Appendable&nbsp;buffer,
java.util.Map&lt;?,&#8203;?&gt;&nbsp;map)</pre>
</li>
</ul>
<a id="appendArray(java.lang.Appendable,java.util.Collection)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendArray</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendArray&#8203;(java.lang.Appendable&nbsp;buffer,
java.util.Collection&lt;?&gt;&nbsp;collection)</pre>
</li>
</ul>
<a id="appendArray(java.lang.Appendable,java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendArray</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendArray&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Object&nbsp;array)</pre>
</li>
</ul>
<a id="appendBoolean(java.lang.Appendable,java.lang.Boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendBoolean</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendBoolean&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Boolean&nbsp;b)</pre>
</li>
</ul>
<a id="appendNumber(java.lang.Appendable,java.lang.Number)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendNumber</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendNumber&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.Number&nbsp;number)</pre>
</li>
</ul>
<a id="appendString(java.lang.Appendable,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>appendString</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;appendString&#8203;(java.lang.Appendable&nbsp;buffer,
java.lang.String&nbsp;string)</pre>
</li>
</ul>
<a id="newMap()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newMap</h4>
<pre class="methodSignature">protected&nbsp;java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;&nbsp;newMap()</pre>
<div class="block"><p>Factory method that creates a Map when a JSON representation of <code>{...}</code> is parsed.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new Map representing the JSON object</dd>
</dl>
</li>
</ul>
<a id="newArray(int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newArray</h4>
<pre class="methodSignature">protected&nbsp;java.lang.Object[]&nbsp;newArray&#8203;(int&nbsp;size)</pre>
<div class="block"><p>Factory method that creates an array when a JSON representation of <code>[...]</code> is parsed.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>size</code> - the size of the array</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new array representing the JSON array</dd>
</dl>
</li>
</ul>
<a id="contextForArray()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>contextForArray</h4>
<pre class="methodSignature">protected&nbsp;<a href="JSON.html" title="class in org.eclipse.jetty.util.ajax">JSON</a>&nbsp;contextForArray()</pre>
<div class="block"><p>Every time a JSON array representation <code>[...]</code> is parsed, this method is called
to (possibly) return a different JSON instance (for example configured with different
converters) to parse the array items.</p></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a JSON instance to parse array items</dd>
</dl>
</li>
</ul>
<a id="contextFor(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>contextFor</h4>
<pre class="methodSignature">protected&nbsp;<a href="JSON.html" title="class in org.eclipse.jetty.util.ajax">JSON</a>&nbsp;contextFor&#8203;(java.lang.String&nbsp;field)</pre>
<div class="block"><p>Every time a JSON object field representation <code>{"name": value}</code> is parsed,
this method is called to (possibly) return a different JSON instance (for example
configured with different converters) to parse the object field.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>field</code> - the field name</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a JSON instance to parse the object field</dd>
</dl>
</li>
</ul>
<a id="convertTo(java.lang.Class,java.util.Map)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>convertTo</h4>
<pre class="methodSignature">protected&nbsp;java.lang.Object&nbsp;convertTo&#8203;(java.lang.Class&lt;?&gt;&nbsp;type,
java.util.Map&lt;java.lang.String,&#8203;java.lang.Object&gt;&nbsp;map)</pre>
</li>
</ul>
<a id="addConvertor(java.lang.Class,org.eclipse.jetty.util.ajax.JSON.Convertor)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addConvertor</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;addConvertor&#8203;(java.lang.Class&lt;?&gt;&nbsp;forClass,
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;convertor)</pre>
<div class="block"><p>Registers a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for the given class.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>forClass</code> - the class the convertor applies to</dd>
<dd><code>convertor</code> - the convertor for the class</dd>
</dl>
</li>
</ul>
<a id="addConvertorFor(java.lang.String,org.eclipse.jetty.util.ajax.JSON.Convertor)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addConvertorFor</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;addConvertorFor&#8203;(java.lang.String&nbsp;name,
<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;convertor)</pre>
<div class="block"><p>Registers a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for a named class.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the class the convertor applies to</dd>
<dd><code>convertor</code> - the convertor for the class</dd>
</dl>
</li>
</ul>
<a id="removeConvertor(java.lang.Class)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeConvertor</h4>
<pre class="methodSignature">public&nbsp;<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;removeConvertor&#8203;(java.lang.Class&lt;?&gt;&nbsp;forClass)</pre>
<div class="block"><p>Unregisters a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for a class.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>forClass</code> - the class the convertor applies to</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the convertor for the class</dd>
</dl>
</li>
</ul>
<a id="removeConvertorFor(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeConvertorFor</h4>
<pre class="methodSignature">public&nbsp;<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;removeConvertorFor&#8203;(java.lang.String&nbsp;name)</pre>
<div class="block"><p>Unregisters a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> for a named class.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the class the convertor applies to</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the convertor for the class</dd>
</dl>
</li>
</ul>
<a id="getConvertor(java.lang.Class)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getConvertor</h4>
<pre class="methodSignature">protected&nbsp;<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;getConvertor&#8203;(java.lang.Class&lt;?&gt;&nbsp;forClass)</pre>
<div class="block"><p>Looks up a convertor for a class.</p>
<p>If no match is found for the class, then the interfaces
for the class are tried.
If still no match is found, then the super class and its
interfaces are tried iteratively.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>forClass</code> - the class to look up the convertor</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> or null if none was found for the class</dd>
</dl>
</li>
</ul>
<a id="getConvertorFor(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getConvertorFor</h4>
<pre class="methodSignature">public&nbsp;<a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Convertor</a>&nbsp;getConvertorFor&#8203;(java.lang.String&nbsp;name)</pre>
<div class="block"><p>Looks up a convertor for a class name.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - name of the class to look up the convertor</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a <a href="JSON.Convertor.html" title="interface in org.eclipse.jetty.util.ajax"><code>JSON.Convertor</code></a> or null if none were found.</dd>
</dl>
</li>
</ul>
<a id="parse(org.eclipse.jetty.util.ajax.JSON.Source,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parse</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;parse&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source,
boolean&nbsp;stripOuterComment)</pre>
<div class="block"><p>Parses the given JSON source into an object.</p>
<p>Although the JSON specification does not allow comments (of any kind)
this method optionally strips out outer comments of this form:</p>
<pre>
// An outer comment line.
/&#42; Another outer comment, multiline.
// Yet another comment line.
{
"name": "the real JSON"
}
&#42;/ End of outer comment, multiline.
</pre></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - the JSON source to parse</dd>
<dd><code>stripOuterComment</code> - whether to strip outer comments</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the object constructed from the JSON string representation</dd>
</dl>
</li>
</ul>
<a id="fromJSON(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromJSON</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;fromJSON&#8203;(java.lang.String&nbsp;string)</pre>
<div class="block"><p>Parses the given JSON string into an object.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>string</code> - the JSON string to parse</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the object constructed from the JSON string representation</dd>
</dl>
</li>
</ul>
<a id="fromJSON(java.io.Reader)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>fromJSON</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;fromJSON&#8203;(java.io.Reader&nbsp;reader)</pre>
<div class="block"><p>Parses the JSON from the given Reader into an object.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>reader</code> - the Reader to read the JSON from</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the object constructed from the JSON string representation</dd>
</dl>
</li>
</ul>
<a id="parse(org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parse</h4>
<pre class="methodSignature">public&nbsp;java.lang.Object&nbsp;parse&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
<div class="block"><p>Parses the given JSON source into an object.</p>
<p>Although the JSON specification does not allow comments (of any kind)
this method strips out initial comments of this form:</p>
<pre>
// An initial comment line.
/&#42; An initial
multiline comment &#42;/
{
"name": "foo"
}
</pre>
<p>This method detects the object type and calls other
parse methods for each object type, see for example
<a href="#parseArray(org.eclipse.jetty.util.ajax.JSON.Source)"><code>parseArray(Source)</code></a>.</p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>source</code> - the JSON source to parse</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the object constructed from the JSON string representation</dd>
</dl>
</li>
</ul>
<a id="handleUnknown(org.eclipse.jetty.util.ajax.JSON.Source,char)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>handleUnknown</h4>
<pre class="methodSignature">protected&nbsp;java.lang.Object&nbsp;handleUnknown&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source,
char&nbsp;c)</pre>
</li>
</ul>
<a id="parseObject(org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseObject</h4>
<pre class="methodSignature">protected&nbsp;java.lang.Object&nbsp;parseObject&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
<a id="parseArray(org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseArray</h4>
<pre class="methodSignature">protected&nbsp;java.lang.Object&nbsp;parseArray&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
<a id="parseString(org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseString</h4>
<pre class="methodSignature">protected&nbsp;java.lang.String&nbsp;parseString&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
<a id="parseNumber(org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>parseNumber</h4>
<pre class="methodSignature">public&nbsp;java.lang.Number&nbsp;parseNumber&#8203;(<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
<a id="seekTo(char,org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>seekTo</h4>
<pre class="methodSignature">protected&nbsp;void&nbsp;seekTo&#8203;(char&nbsp;seek,
<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
<a id="seekTo(java.lang.String,org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>seekTo</h4>
<pre class="methodSignature">protected&nbsp;char&nbsp;seekTo&#8203;(java.lang.String&nbsp;seek,
<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
<a id="complete(java.lang.String,org.eclipse.jetty.util.ajax.JSON.Source)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>complete</h4>
<pre class="methodSignature">protected static&nbsp;void&nbsp;complete&#8203;(java.lang.String&nbsp;seek,
<a href="JSON.Source.html" title="interface in org.eclipse.jetty.util.ajax">JSON.Source</a>&nbsp;source)</pre>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/JSON.html">Use</a></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" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;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>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
<p class="legalCopy"><small>Copyright &#169; 1995&#x2013;2021 <a href="https://webtide.com">Webtide</a>. All rights reserved.</small></p>
</footer>
</body>
</html>