An actor that converts a string containing JSON-formatted data into a Token.
Depending on the top level structure found in the JSON string, it produces
either a RecordToken or an ArrayToken on its output port. Nested structures
in the JSON data will translate to correspondingly nested structures in the
Token.
<p>The JSONObject parser processes values as follows:
Delimited values are always parsed as a String. Values that are not delimited
are tested in the order noted below. The first test that succeeds determines
the type.
<ul>
<li>'true' | 'false' => Boolean (case insensitive)</li>
<li>'null' => JSONObject.NULL (case insensitive)</li>
<li>'0x..' => Integer (hexadecimal)</li>
<li>x'.'y | exponent encoded => Double</li>
<li>x => Long, or Integer if value remains the same after conversion</li>
</ul>
If non of the above apply, the value is interpreted as a String.</p>
<p>Note that JSON allows array elements to have different types, whereas the
<code>ArrayToken</code> does not. Conversion of such mixed array will result
in an <code>ArrayToken</code> of which the types of all elements are cast to
the least upper bound of the entire collection.</p>
<p><a href="http://www.json.org/">http://www.json.org/</a>
- a description of the JSON format.</p>
Marten Lohstroh, Contributor: Beth Latronico
$Id: JSONToToken.java 70402 2014-10-23 00:52:20Z cxh $
Ptolemy II 10.0
Yellow (marten)
Red (chx)