On Tue, 25 Aug 2026 21:48:43 GMT, Naoto Sato <[email protected]> wrote:

>> This PR implements [JEP 540: Simple JSON API 
>> (Incubator)](https://openjdk.org/jeps/540).
>> 
>> It adds the `jdk.incubator.json` module which provides APIs for reading and 
>> writing JSON documents as specified by [RFC 
>> 8259](https://datatracker.ietf.org/doc/html/rfc8259). This is an incubating 
>> API.
>> 
>> API documentation: 
>> https://cr.openjdk.org/~naoto/json/javadoc/api/jdk.incubator.json/module-summary.html
>> Co-authored-by: Justin Lu 
>> ([@justin-curtis-lu](https://github.com/justin-curtis-lu))
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Naoto Sato has updated the pull request incrementally with five additional 
> commits since the last revision:
> 
>  - Merge remote-tracking branch 'jdk-sandbox/json' into 
> JDK-8381976-Implementation-for-Simple-JSON-API
>  - "lang=json" in @snippets
>  - Adding links, example modifications in the package-info.java
>  - Fix broken links for access and conversion sections
>  - package-info wording refinement

These can use the new URI fragment link format:

src/jdk.incubator.json/share/classes/jdk/incubator/json/JsonValue.java line 48:

> 46:  * <p>Instances of {@code JsonValue} are immutable and thread safe. See 
> the
> 47:  * <a href="package-summary.html">package documentation</a>
> 48:  * for an overview of parsing, accessing, converting, and generating JSON 
> text.

Suggestion:

 * <p>Code that relies on equality or hashing should utilize the results of a
 * {@linkplain jdk.incubator.json/jdk.incubator.json##conversion conversion}
 * method instead of the {@code JsonValue} itself.
 *
 * <p>Instances of {@code JsonValue} are immutable and thread safe. See the
 * {@linkplain jdk.incubator.json/jdk.incubator.json package documentation}
 * for an overview of parsing, accessing, converting, and generating JSON text.

(it might be possible to shorten these to just 
`jdk.incubator.json##<fragment>`, but that might try linking to the module doc 
instead)

src/jdk.incubator.json/share/classes/jdk/incubator/json/JsonValueException.java 
line 38:

> 36:  *     <a href="package-summary.html#conversion">conversion</a> method is 
> invoked on a
> 37:  *     {@code JsonValue} of an incompatible type. For example, calling
> 38:  *     {@code asBoolean()} on a {@code JsonString}.

Suggestion:

 *     An {@link jdk.incubator.json/jdk.incubator.json##access access} or a
 *     {@link jdk.incubator.json/jdk.incubator.json##conversion conversion} 
method
 *     is invoked on a {@code JsonValue} of an incompatible type. For example, 
calling
 *     {@code asBoolean()} on a {@code JsonString}.

src/jdk.incubator.json/share/classes/jdk/incubator/json/package-info.java line 
32:

> 30:  * <a href="#parsing">parsing</a> JSON text into a {@code JsonValue}, <a 
> href="#access">navigating</a>
> 31:  * the parsed JSON value to the desired JSON value using <i>access</i> 
> methods, and lastly
> 32:  * <a href="#conversion">converting</a> the desired value using a 
> <i>conversion</i> method.

Suggestion:

 * This API supports processing of JSON text in a simple manner. It is 
organized around the {@link
 * JsonValue} interface which represents a JSON value, and the {@link Json} 
class which provides
 * methods to parse and generate JSON text. Typical usage of this API involves 
first
 * {@linkplain ##parsing parsing} JSON text into a {@code JsonValue}, 
{@linkplan ##access navigating}
 * the parsed JSON value to the desired JSON value using <i>access</i> methods, 
and lastly
 * {@linkplan ##conversion converting} the desired value using a 
<i>conversion</i> method.

-------------

PR Review: https://git.openjdk.org/jdk/pull/32282#pullrequestreview-5024854464
PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3858025404
PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3858031620
PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3858051138

Reply via email to