| <!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 (9.0.1) on Fri Dec 28 04:30:35 EST 2018 --> |
| <title>Overview (JSR 374 (JSON Processing) API 1.1.5 API)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="date" content="2018-12-28"> |
| <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-1.10.2.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="Overview (JSR 374 (JSON Processing) API 1.1.5 API)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var pathtoroot = "./";loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="fixedNav"> |
| <!-- ========= 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 class="navBarCell1Rev">Overview</li> |
| <li><a href="java.json-summary.html">Module</a></li> |
| <li>Package</li> |
| <li>Class</li> |
| <li>Use</li> |
| <li><a href="overview-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>Prev</li> |
| <li>Next</li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="index.html?overview-summary.html" target="_top">Frames</a></li> |
| <li><a href="overview-summary.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> |
| <ul class="navListSearch"> |
| <li><span>SEARCH: </span> |
| <input type="text" id="search" value=" " disabled="disabled"> |
| <input type="reset" id="reset" value=" " 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> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| <div class="header"> |
| <h1 class="title">JSR 374 (JSON Processing) API 1.1.5 API</h1> |
| </div> |
| <div class="contentContainer"> |
| <div class="block">The Java API for JSON Processing provides portable APIs to parse, |
| generate, transform, and query <a href="http://json.org/">JSON</a> using the |
| streaming API or the object model API. |
| |
| <p>The Streaming API provides a way to parsing and generation of JSON in a |
| streaming fashion. It hands over parsing and generation control to the |
| programmer. The streaming API provides an event-based parser and allows an |
| application developer to ask for the next event rather than handling the event |
| in a callback. This gives a developer more procedural control over |
| the processing of the JSON. Application code can process or discard |
| the parser event, and ask for the next event(pull the event). The |
| streaming model is adequate for local processing where random access of other |
| parts of the data is not required. Similarly, the streaming API provides |
| a way to generate well-formed JSON to a stream by writing one event at a time. |
| |
| <p>The object model API creates a random access tree-like structure that |
| represents the JSON data in memory. The tree can then be navigated and |
| queried. This programming model is the most flexible and enables processing |
| that requires random access to the complete contents of the tree. However, |
| it is often not as efficient as the streaming model and requires more memory. |
| The object model generates JSON output by navigating the entire tree at once. |
| |
| <h2>The Streaming API</h2> |
| <p>The streaming API is similar to the StAX API for XML and consists of the |
| interfaces <a href="javax/json/stream/JsonParser.html" title="interface in javax.json.stream"><code>JsonParser</code></a> and |
| <a href="javax/json/stream/JsonGenerator.html" title="interface in javax.json.stream"><code>JsonGenerator</code></a>. <code>JsonParser</code> |
| contains methods to parse JSON data using the streaming model. |
| <code>JsonGenerator</code> contains methods to write JSON data to an ouptut source. |
| |
| <p><code>JsonParser</code> provides forward, read-only access to |
| JSON data using the pull parsing programming model. In this model the |
| application code controls the thread and calls methods in the parser interface |
| to move the parser forward or to obtain JSON data from the current state of |
| the parser. Refer to |
| <a href="javax/json/stream/JsonParser.html#JsonParserExample2">this example</a> |
| for more details. |
| |
| <p><code>JsonGenerator</code> provides methods to write JSON to a stream. The |
| generator writes name/value pairs in JSON objects and values in JSON arrays. |
| Refer to |
| <a href="javax/json/stream/JsonGenerator.html#JsonGeneratorExample3">this |
| example</a> for more details. |
| |
| <p>The streaming API is a low-level API designed to process large amounts of |
| JSON data efficiently. Other JSON frameworks (such as JSON binding) can be |
| implemented using this API.</p> |
| |
| <h2>The Object Model API</h2> |
| <p>The object model API is similar to the DOM API for XML. It is a high-level |
| API that provides immutable object models for JSON object and array structures. |
| These JSON structures are represented as object models using the Java types |
| <a href="javax/json/JsonObject.html" title="interface in javax.json"><code>JsonObject</code></a> and <a href="javax/json/JsonArray.html" title="interface in javax.json"><code>JsonArray</code></a>. |
| <code>JsonObject</code> provides a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util"><code>Map</code></a> view to access the unordered |
| collection of zero or more name/value pairs from the model. Similarly, |
| <code>JsonArray</code> provides a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util"><code>List</code></a> view to access the ordered |
| sequence of zero or more values from the model. |
| |
| <p>The object model API uses builder patterns to create these object models. |
| Application code can use the interface <a href="javax/json/JsonObjectBuilder.html" title="interface in javax.json"><code>JsonObjectBuilder</code></a> |
| to create models that represent JSON objects. The resulting model is of type |
| <code>JsonObject</code>. Refer to |
| <a href="javax/json/JsonObjectBuilder.html#JsonObjectBuilderExample1">this example</a> |
| for more details. Application code can use the interface |
| <a href="javax/json/JsonArrayBuilder.html" title="interface in javax.json"><code>JsonArrayBuilder</code></a> to create models that represent JSON arrays. |
| The resulting model is of type <code>JsonArray</code>. Refer to |
| <a href="javax/json/JsonArrayBuilder.html#JsonArrayBuilderExample1">this example</a> |
| for more details. |
| |
| <p>These object models can also be created from an input source (such as |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><code>InputStream</code></a> or <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Reader.html?is-external=true" title="class or interface in java.io"><code>Reader</code></a>) using the interface |
| <a href="javax/json/JsonReader.html" title="interface in javax.json"><code>JsonReader</code></a>. |
| <a href="javax/json/JsonReader.html#JsonReaderExample1">This example</a> shows |
| how to read and create an empty <code>JsonArray</code> model using the interface |
| <code>JsonReader</code>. Similarly, these object models can be written to an output |
| source (such as <a href="https://docs.oracle.com/javase/8/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io"><code>OutputStream</code></a> or <a href="https://docs.oracle.com/javase/8/docs/api/java/io/Writer.html?is-external=true" title="class or interface in java.io"><code>Writer</code></a>) using |
| the class <a href="javax/json/JsonWriter.html" title="interface in javax.json"><code>JsonWriter</code></a>. |
| <a href="javax/json/JsonWriter.html#JsonWriterExample1">This example</a> shows |
| how to write an empty <code>JsonObject</code> model using the interface |
| <code>JsonWriter</code>. |
| |
| <h2>JSON Pointer, JSON Patch, and JSON Merge Patch</h2> |
| The Java API for JSON Processing supports the latest standard on |
| <a href="http://tools.ietf.org/html/rfc6901">JSON Pointer</a>, |
| <a Href="http://tools.ietf.org/html/rfc6902">JSON Patch</a>, and |
| <a Href="http://tools.ietf.org/html/rfc7396">JSON Merge Patch</a>.</div> |
| </div> |
| <div class="contentContainer"><a name="OtherModules"> |
| <!-- --> |
| </a> |
| <table class="overviewSummary" summary="Other Modules table, listing modules, and an explanation"> |
| <caption><span>Other Modules</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Module</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tbody> |
| <tr class="altColor"> |
| <th class="colFirst" scope="row"><a href="java.json-summary.html">java.json</a></th> |
| <td class="colLast"> </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <!-- ======= 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 class="navBarCell1Rev">Overview</li> |
| <li><a href="java.json-summary.html">Module</a></li> |
| <li>Package</li> |
| <li>Class</li> |
| <li>Use</li> |
| <li><a href="overview-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>Prev</li> |
| <li>Next</li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="index.html?overview-summary.html" target="_top">Frames</a></li> |
| <li><a href="overview-summary.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> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2012-2018, <a href="http://www.oracle.com">Oracle</a> and/or its affiliates. All Rights Reserved. Use is subject to <a href="./doc-files/speclicense.html" target="_top">license terms</a>. <br>Comments to : jsonp-dev@eclipse.org</small></p> |
| </body> |
| </html> |