Re: [Json] [Technical Errata Reported] RFC8259 (7307)

Tim Bray <tbray@textuality.com> Fri, 13 January 2023 17:54 UTC

Return-Path: <tbray@textuality.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 78F94C151531 for <json@ietfa.amsl.com>; Fri, 13 Jan 2023 09:54:04 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=textuality-com.20210112.gappssmtp.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fNB8QpNWEg71 for <json@ietfa.amsl.com>; Fri, 13 Jan 2023 09:53:59 -0800 (PST)
Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6B249C151546 for <json@ietf.org>; Fri, 13 Jan 2023 09:53:59 -0800 (PST)
Received: by mail-ej1-x631.google.com with SMTP id u9so54073429ejo.0 for <json@ietf.org>; Fri, 13 Jan 2023 09:53:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=textuality-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=K26jyBEKUY4/VTY5+l45PhrYlSZ/ZwYH5207E41zK40=; b=syxxolsIhbFmgsW+yk0cei9gkC90Z9uXtcK1gZQx51hxAP1J5oURVvyQI9CxVYlMx6 kGNnWvgPyqhHYqcvw8VvYt0bj7neUXRWNV/v2hI+n4R7y1LKdMoU8V8hHiUGQwjIpT57 S3zrZc+foUiFxjkpm1mPpnixKifaFk9L/kKnaAccxtsrB14ULfKpep6ycMtYY5AxEbrQ q6+f+bTwfJim1XD6BiOHxxzBQqhs6GfjLyLaxLIcsdNaBJQusIhgnBvmN9vIPKh0O5fm FL+FVhfqW+3i/2KNvF55VG6BbwgiJDNN0Yehz3LwXkBpn/wqso6DkIYZ2quyN/60cO1j Y3yA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K26jyBEKUY4/VTY5+l45PhrYlSZ/ZwYH5207E41zK40=; b=2RqNUnzbOF0Wy4QLt1ggdIl5sjrcNxTcp7Dv9GT/3EENQW2YEXBm447o8A6938KnDx CNhpMjNaEqHXVB2ZI3fzfxqFC/iyk995TSp0mQpHlBIkIlkjxW9xC//PPB67mIwO85uk c5Oi5dA15UKOqe4lEeKMjkp7DZun89IfJvgBdZl8giHtEZaCsQVxHkdFLQJt0mUIOJXX 5xT8Q8fcZ88vzCo7sHxqvrtmLT83+lumBojlNtXZeeBwmLn66IevZ1KE4SvpySsOKbhb YAvOFGbXKp4n/j43SbKBH6R2b5rSL8TZ+hpLBtYLhqpR/JHX39Lsmv91l5n9N4j8HhY5 Ua+g==
X-Gm-Message-State: AFqh2kqTk9T6MCmCS7ljvdnISEBT+5G4Wt+9FTddFHWwDikQAd5aX3IM OqknNsGOJjxUUwyAQcg4DSs9Gj84qfp/l/dBqltHDg==
X-Google-Smtp-Source: AMrXdXvSaGUMO8ye3klCp8AdpK+Yp0mjC4T1Jy5vFVPHWITYyJ4Qp03kWFu75Jb5EwNgviTc03ptUUO4v4fK7H4M8t4=
X-Received: by 2002:a17:907:8c19:b0:86b:aa56:7458 with SMTP id ta25-20020a1709078c1900b0086baa567458mr160043ejc.53.1673632437426; Fri, 13 Jan 2023 09:53:57 -0800 (PST)
MIME-Version: 1.0
References: <20230113110657.F0A644C292@rfcpa.amsl.com> <B11BA595-E479-4BA0-8CE0-5260B689D908@tzi.org> <19064163.604313.1673632048434@mail.yahoo.com>
In-Reply-To: <19064163.604313.1673632048434@mail.yahoo.com>
From: Tim Bray <tbray@textuality.com>
Date: Fri, 13 Jan 2023 09:53:46 -0800
Message-ID: <CAHBU6isAANZutZN5S6_kvn3DKJS_vwyFEWuEXA1Vx4rCaMOGmg@mail.gmail.com>
To: Iurie Maxim <iurie@yahoo.com>
Cc: RFC Errata System <rfc-editor@rfc-editor.org>, Carsten Bormann <cabo@tzi.org>, "superuser@gmail.com" <superuser@gmail.com>, "francesca.palombini@ericsson.com" <francesca.palombini@ericsson.com>, "linuxwolf+ietf@outer-planes.net" <linuxwolf+ietf@outer-planes.net>, "json@ietf.org" <json@ietf.org>
Content-Type: multipart/related; boundary="000000000000eb521a05f228ea65"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/UlKd4H7MM3d_ePLZtNoruo7B9vY>
Subject: Re: [Json] [Technical Errata Reported] RFC8259 (7307)
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 13 Jan 2023 17:54:04 -0000

RFC8259 doesn't help you very much.  For atomic types it provides strings,
numbers, true, false, and null.  How you use these to represent your data
is up to you.

It's almost certainly wrong to use the string "null" to represent an absent
string field, because "null" is also a perfectly reasonable value.

In general it's reasonable to use the built-in null primitive (no quotes)
to represent absent data, but of course your code which is reading the JSON
will have to understand this.

JSON schema operates on a level above JSON and I'm not really an expert.
I've looked at it but find it quite hard to understand.

On Fri, Jan 13, 2023 at 9:47 AM Iurie Maxim <iurie@yahoo.com> wrote:

> Dear Carsten,
>
> Thank you very much for reply,
>
> Unfortunately, as I am not an expert neither in JSON, neither in writing
> an RFC, I wrote the errata as it is not clear for many of us how a web
> service should provide a response in JSON format if an attribute includes a
> <Null> value in the database and we have a debate in the company involving
> already too many people.
>
> Various implementations that are providing data trough an API, are
> encoding <Null> values from the database, in one of the following ways in
> JSON:
>
> 1) {"StringAttribute":null}, {"NumericAttribute":null}
> 2) {"StringAttribute":"null"}, {"NumericAttribute":null}
> 3) {"StringAttribute":"null"}, {"NumericAttribute":0} - this last is quite
> wrong I would say, or at least changing the original data where null is
> used for No data, but this seems to be correct according to ECMA 262.
>
> Can you please clarify which one of the above is correct?
>
> RFC 8259 is mentioning
>
> 3 <https://www.rfc-editor.org/rfc/rfc8259#section-3>.  Values
>
>    A JSON value MUST be an object, array, number, or string, or one of
>    the following three literal names:
>
>       false
>       null
>       true
>
>
> We saw all versions:
>
> a) {"Attribute1":false}, {"Attribute2":null}
> b) {"Attribute1":"false"}, {"Attribute2":null}
> c) {"Attribute1":false}, {"Attribute2":"null"}
> d) {"Attribute1":"false"}, {"Attribute2":"null"}
>
> Can you please clarify which one is correct?
>
> Below are some examples:
>
> 1) Any JSON validator that we use is validating all above encodings
> including for <null> and <false>.
>
> 2) This is how ESRI (www.esri.com) is encoding <Null> values from the
> database in a GeoJSON provided trough a Web Feature Service:
>
>
> "CountInitiallyInsertedRecords":633,"CountUnchangedRecords":null,"ListChangedAttributes":"null"
>
> [image: Inline image]
>
> 3) Here https://www.json.org/json-en.html <Null> it is written between
> quotation marks, as "null"
> [image: Inline image]
>
> 4) Here https://www.w3schools.com/js/js_json_datatypes.asp it is provided
> as example null without quotation marks
>
> [image: Inline image]
>
> 5) Here
> https://json-schema.org/understanding-json-schema/reference/null.html,
> although it is about the JSON schema, null is between quotation marks:
>
>  [image: Inline image]
>
> Really appreciate a clear response.
>
> The reason why I sent the ERATA is because in our company it is not clear
> which one is correct and neither RFC 8259 is providing a clear answer in
> conjunction with ECMA 262, neither we found official information which
> encoding are correct and which are incorrect.
>
> Best regards,
> Iurie MAxim
>
> On Friday, January 13, 2023 at 02:36:18 PM GMT+2, Carsten Bormann <
> cabo@tzi.org> wrote:
>
>
> This errata report needs to be rejected.
>
> While it is easy to write documentation that is confusing, RFC 8259 is
> very clear here.
> A string, which always use ASCII typewriter quotation marks, is different
> from one of the special values »false«, »true«, or »null«, which do not use
> quotation marks.
> (Note that I used different quotation marks in this sentence, because the
> ASCII typewriter quotation marks I would normally use are exactly what is
> used in JSON to notate a string — hence much of the confusion.)
>
> In RFC 8949 [0] we went so far to invent our own convention for
> identifying JSON text in paragraphs (using angle brackets instead of the
> guillemets [1] I used above, which couldn’t be used in RFCs in 2020):
>
>   The notation borrows the JSON syntax for numbers (integer and
>   floating-point), True (>true<), False (>false<), Null (>null<), UTF-8
>   strings, arrays, and maps (maps are called objects in JSON; […]
>
> Anyway, there is no errata here in RFC 8259.
>
> Grüße, Carsten
>
>
> [0]: https://www.rfc-editor.org/rfc/rfc8949.html#section-8-4
> [1]: https://en.wikipedia.org/w/index.php?title=Guillemet
>
>
> > On 2023-01-13, at 12:06, RFC Errata System <rfc-editor@rfc-editor.org>
> wrote:
> >
> > The following errata report has been submitted for RFC8259,
> > "The JavaScript Object Notation (JSON) Data Interchange Format".
> >
> > --------------------------------------
> > You may review the report below and at:
> > https://www.rfc-editor.org/errata/eid7307
> >
> > --------------------------------------
> > Type: Technical
> > Reported by: Maxim Iurie <iurie@yahoo.com>
> >
> > Section: 3
> >
> > Original Text
> > -------------
> >      null  = %x6e.75.6c.6c      ; null
> >
> > Corrected Text
> > --------------
> >      null  = %x6e.75.6c.6c      ; null without quotation marks for
> numeric attributes and "null" for string attributes.
> >
> > Notes
> > -----
> > It is not clear how to encode null values in JSON.
> > Some are encoding all attributes as "null".
> > Some are encoding all attributes as null without quotation marks
> > Some are encoding string attributes as "null" and numeric attributes as
> null without quotation marks.
> > https://json.org is mentioning "null". ECMA 262  is mentioning "null"
> for string and +0F for numeric attributes. However providing zero for a
> number instead of null is incorrect and provides wrong results (in BI).
> >
> > Instructions:
> > -------------
> > This erratum is currently posted as "Reported". If necessary, please
> > use "Reply All" to discuss whether it should be verified or
> > rejected. When a decision is reached, the verifying party
> > can log in to change the status and edit the report, if necessary.
> >
> > --------------------------------------
> > RFC8259 (draft-ietf-jsonbis-rfc7159bis-04)
> > --------------------------------------
> > Title              : The JavaScript Object Notation (JSON) Data
> Interchange Format
> > Publication Date    : December 2017
> > Author(s)          : T. Bray, Ed.
> > Category            : INTERNET STANDARD
> > Source              : Javascript Object Notation Update
> > Area                : Applications and Real-Time
> > Stream              : IETF
> > Verifying Party    : IESG
>
> >
> > _______________________________________________
> > json mailing list
> > json@ietf.org
> > https://www.ietf.org/mailman/listinfo/json
>
>
>