On Mon, 10 Aug 2026 17:36:35 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). src/jdk.incubator.json/share/classes/jdk/incubator/json/Json.java line 98: > 96: * @return the parsed {@code JsonValue} > 97: */ > 98: public static JsonValue parse(char[] in) { Hi, thank you very much for doing this! I know the JSON API solves a simple enough problem to attract a lot of bikeshedding, please ignore if feedback is not useful at this stage, I just couldn't help myself. That said, I don't think this method carries its weight: 1. When do you actually have a `char[]` filled completely with a JSON document (or a `char[]` instead of a `byte[]` in general)? When I dealt with `char[]` in the past it was either for password input (not applicable here), buffering for APIs that use `char[]` instead of `byte[]` (also not applicable here) and as the result of calling `String::toCharArray` because some rearrangements are easier expressed in that form (also not applicable here, the result of shuffling characters in a fixed size `char[]` rarely is a valid JSON document and if you have a String already, call the String overload). Even `java.io.Reader` makes it hard to get a `char[]` without an intermediate `String`. 2. JSON is usually UTF-8, `char[]` encourages a wasteful representation 3. The current implementation makes it easy to accept a `char[]`, but even now it requires cloning it ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32282#discussion_r3754155056
