Re: [Json] [Technical Errata Reported] RFC8259 (7307)
Tim Bray <tbray@textuality.com> Fri, 13 January 2023 18:46 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 94F65C15952B for <json@ietfa.amsl.com>; Fri, 13 Jan 2023 10:46:56 -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 dgjR4imvs7AE for <json@ietfa.amsl.com>; Fri, 13 Jan 2023 10:46:51 -0800 (PST)
Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) (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 8B337C1595FB for <json@ietf.org>; Fri, 13 Jan 2023 10:46:50 -0800 (PST)
Received: by mail-ed1-x529.google.com with SMTP id w14so15033427edi.5 for <json@ietf.org>; Fri, 13 Jan 2023 10:46:50 -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=cGPaWJOZJxuD2IoiCUq7VIZ8nC03qvaFeChbVEcOE8I=; b=wxpjFknvODSiJyW1aoLfbQm8tyux/W/KiL1z9TiBYrDtmj6TXh0SUhNJE7FWnToEwI Xd2fDa9l4RN0re/vi24N9Ww5Otnm6apBXb1jVvMjAaU6vXR+FqAkOThFh586hDddQOhp Uy8orYrSXoMB+vfUJOaVEsfP4hhOCIGlDWSFiO0blqniKXWIC4muYwPRHP4r2TpyaIge AjVkYkxYKfLh4dN3s1nFvKH7Cu7lXJDSuZJVrVpo0i7h+PK1dVAxtpgQ0+zLxa6wYyRw RvYX0PjfT1KGlrpX7TAb15vJ7h/hUWVItDaPk9p01BkU9sABujGOUwYfO3C2WRmBrNa0 ox1A==
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=cGPaWJOZJxuD2IoiCUq7VIZ8nC03qvaFeChbVEcOE8I=; b=kj4GZZzW+xtSikAZ1E/7SjptE4Tu2eryl4VhHozUz3i9h6prGPLYHh3mQzEWij1Dl3 8Cebt2W8xSa3FTbKVmMESV7TQoX3GNEgR6TZ1rxlFX+gRiQdA0noBh6tikCXGjWHDcxc mixDFlN8DPJmzUJbq+MVdksvxV88WOqqXYRdn5a6uYnCV0CfwC3vZVsZ5T85fgEP4wFM HZa6uoY/ES+IUlOQKGobe9Yhv5Wds9PLHwfoRGFdgpldSfrHF9BfWTJBHhnbTD8CkNOo f3eoXV9KC3C7Wqvb0JzfJzru/hcNjMetV9iCzF9P+WrH2G3Zt55DL2A+tw8XzhMnAhIR m8QQ==
X-Gm-Message-State: AFqh2kpReCcfZD07CEtpIFpuXARPkX7JTKu0GYsg2RAQTYu7jq7afTpp Rjr6MWR6V9/93Rot5Cjoh4qyBJeeWnstOJIFiwPWLw==
X-Google-Smtp-Source: AMrXdXvEdI9QsOa1UkJtFRMZka5cYrlv3HPKxoQHh/Vb6dqE5y/vV7BkrnE7ir+sQlOPjsK5Lmf7sKMprPRf3HQqiRs=
X-Received: by 2002:aa7:cad6:0:b0:490:df3b:d889 with SMTP id l22-20020aa7cad6000000b00490df3bd889mr4015930edt.205.1673635608268; Fri, 13 Jan 2023 10:46:48 -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> <CAHBU6isAANZutZN5S6_kvn3DKJS_vwyFEWuEXA1Vx4rCaMOGmg@mail.gmail.com> <822963907.625512.1673633940085@mail.yahoo.com>
In-Reply-To: <822963907.625512.1673633940085@mail.yahoo.com>
From: Tim Bray <tbray@textuality.com>
Date: Fri, 13 Jan 2023 10:46:36 -0800
Message-ID: <CAHBU6iukMp92OQB_vMRXcQbgN5vSqEdeYS1d9PCqHmimL0sLtA@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="000000000000ea405305f229a736"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/df4I82PpJ3FzanBKxNDmGfUuI-4>
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 18:46:56 -0000
Yes, those are interesting ideas for improving JSON. There are a lot of such ideas, such as adding comments, distinguishing between integers and fp numbers, and (my favorite) adding date/time literals. If you'd like, you could try to start up a JSON 2.0 effort to add some of these improvements to JSON. But I don't think that would have much chance of success, I believe the community thinks “JSON is finalized” and it is what it is. But it might be fun to try. On Fri, Jan 13, 2023 at 10:20 AM Iurie Maxim <iurie@yahoo.com> wrote: > Thank you very much Tim, > > Trough the ERATA I wanted to point that RFC8259 is not clear how to encode > Null, and you indicated it quite clear as well: > > "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." > > Wouldn't be then be better to clarify this in the RFC to allow programmers > to clearly provide data in JSON format in a harmonized manner for <null>, > <true> and <false> values? > > You also pointed that "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*" > > Wouldn't then a more clear RFC help all software developers to have the > same understanding of Null and Boolean values and the API's that are > starting to use more and more JSON instead of XML to be more interoperable > instead of writing different code for different APIs even if all are > providing data in JSON format and all data providers are correctly claiming > that their JSON is correct according to RFC8259? > > If using {"Attribute1":null}, what about <true> and <false> taking into > consideration: > > 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 > > > a) {"Attribute2":false} or > b) {"Attribute2":"false"} > > Is RFC8250 or ECMA262 clarifying what is expected to be provided for > Boolean values in a JSON ? > > Iurie > > On Friday, January 13, 2023 at 07:53:59 PM GMT+2, Tim Bray < > tbray@textuality.com> wrote: > > > 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 > > >
- [Json] [Technical Errata Reported] RFC8259 (7307) RFC Errata System
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Carsten Bormann
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Julian Reschke
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Pete Cordell
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Tim Bray
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Tim Bray
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Carsten Bormann
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Tim Bray
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Carsten Bormann
- Re: [Json] [Technical Errata Reported] RFC8259 (7… Rob Sayre