From f7cefcb426fed89365ab42daa387c255b599eb66 Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Mon, 8 Aug 2022 01:24:37 +0200 Subject: [PATCH] Fix JsonWriter documentation regarding top-level value (#1766) * Fix JsonReader / JsonWriter documentation regarding top-level value RFC 7159 allows any top-level value (not only arrays or objects) [0], however when #773 added this functionality it appears the author forgot to update the documentation of these classes. [0] https://tools.ietf.org/html/rfc7159#appendix-A > Changed the definition of "JSON text" so that it can be any JSON > value, removing the constraint that it be an object or array. * Fix missing space --- .../main/java/com/google/gson/stream/JsonWriter.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gson/src/main/java/com/google/gson/stream/JsonWriter.java b/gson/src/main/java/com/google/gson/stream/JsonWriter.java index c281009c..1cc408cd 100644 --- a/gson/src/main/java/com/google/gson/stream/JsonWriter.java +++ b/gson/src/main/java/com/google/gson/stream/JsonWriter.java @@ -42,10 +42,9 @@ import static com.google.gson.stream.JsonScope.NONEMPTY_OBJECT; * and end delimiters of objects and arrays. * *

Encoding JSON

- * To encode your data as JSON, create a new {@code JsonWriter}. Each JSON - * document must contain one top-level array or object. Call methods on the - * writer as you walk the structure's contents, nesting arrays and objects as - * necessary: + * To encode your data as JSON, create a new {@code JsonWriter}. Call methods + * on the writer as you walk the structure's contents, nesting arrays and objects + * as necessary: *