Re: [Json] Proposed document set from this WG

R S <sayrer@gmail.com> Wed, 20 February 2013 06:47 UTC

Return-Path: <sayrer@gmail.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 9D65021F8956 for <json@ietfa.amsl.com>; Tue, 19 Feb 2013 22:47:15 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Level:
X-Spam-Status: No, score=-3.149 tagged_above=-999 required=5 tests=[AWL=-0.150, BAYES_00=-2.599, J_CHICKENPOX_45=0.6, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 060Gtheu36ns for <json@ietfa.amsl.com>; Tue, 19 Feb 2013 22:47:14 -0800 (PST)
Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by ietfa.amsl.com (Postfix) with ESMTP id 8B86D21F8952 for <json@ietf.org>; Tue, 19 Feb 2013 22:47:14 -0800 (PST)
Received: by mail-wi0-f179.google.com with SMTP id ez12so5780882wid.6 for <json@ietf.org>; Tue, 19 Feb 2013 22:47:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=/zOzG6g7NaltUh9tkzu0NBqL58czh1vuI2E5PfzhR4I=; b=xF7sJbuAX7sGbrc9H3goZP22OQSaafqs0eCF5Vp37/1FxqvKl/ypBGGr+tYvhkUHIG Hj1vDg+FPjSC3sZFt/aj0XSbRy46oz2Z/kmLEz9T0HIAKqiTn2xv/Jq3F/SkY3fC2IGZ 3bsBIfu4PKXt8dE7HfjUhHKulN3NLkQrkLkdiQUDhcuCTqniQ5cxykpD9UnJhmMwK+yJ tacg/boWArnGiK9zYW5twyx6BBHaUu/uVHLloIqSxgIF/ZmfsN25Sj7MhsXFe7cAGYcD myLNIwbJK3V7kwR0KspitnmgbpSCB5Wq0X5/bN4wNhenoyi1y7LI805NqU6xTQsKYnGQ aZNg==
MIME-Version: 1.0
X-Received: by 10.180.24.229 with SMTP id x5mr30309819wif.17.1361342833719; Tue, 19 Feb 2013 22:47:13 -0800 (PST)
Received: by 10.194.138.170 with HTTP; Tue, 19 Feb 2013 22:47:13 -0800 (PST)
Date: Tue, 19 Feb 2013 22:47:13 -0800
Message-ID: <CAChr6SxNLJ8kqsMUjiMMhx9w-quUkqEbpPjMF5fF-02jyUNPrQ@mail.gmail.com>
From: R S <sayrer@gmail.com>
To: json@ietf.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Subject: Re: [Json] Proposed document set from this WG
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "Discussion related to JavaScript Object Notation \(JSON\)." <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/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: Wed, 20 Feb 2013 06:47:15 -0000

Paul Hoffman wrote:
> 1) JSON base, 4627bis
>   Target: current JSON users
>   Current: grammar, encoding, parser rules, generator rules, MIME type registration)
>   New: Internet transfer rules, list of changes from 4627

My suggestion is for the WG to target this use case only, and to treat
the JSON processing rules in ECMAScript 5, Section 15.12 (The JSON
Object) as the baseline for rules regarding encoding and decoding,
rather than RFC4627.

The motivation for this recommendation is that it's impractical to
make breaking change to this algorithm on a reasonable time scale.
But JSON RFC readers will expect to interoperate with web browsers
and other JavaScript embeddings.

The most significant delta concerns this line from RFC4627:
> A JSON parser MAY accept non-JSON forms or extensions.

ES5 parsers must raise an error when they encounter deviations from
the grammar defined in ES5:
"It is not permitted for a conforming implementation of JSON.parse to
extend the JSON grammars."

Tim Bray wrote:
> \uxxxx is only allowed for chars that must be escaped per the JSON spec
> \uxxxx is freely allowed, but the \uxxxx is considered to represent a single codepoint, and all comparison/hashing
> operations have to be conducted codepoint-by-codepoint

ES5 mandates \uxxxx for certain control characters and allows it for
all (so does RFC4627 "Any character may be escaped.").  JavaScript
strings are composed of code units. Consider JSONKit's behavior when
serializing escaped Unicode:

"When JKSerializeOptionEscapeUnicode is enabled, JSONKit will encode
Unicode code points that can be encoded as a single UTF16 code unit as
\uXXXX, and will encode Unicode code points that require UTF16
surrogate pairs as \uhigh\ulow."
<https://github.com/johnezang/JSONKit>

json ⊄ js: <https://medium.com/joys-of-javascript/42a28471221d>
> The problem comes down to two unicode characters that are considered line terminators
> in JavaScript: the line separator \u2028 and the paragraph separator \u2029.

Recommend that encoders escape these characters.

Paul Hoffman wrote:
> If we are supposed to be keeping backwards compatibility, then yes, it's too late.
> The same is true for changing SHOULD not have duplicate names in objects.

ES5 mandates behavior here:
"In the case where there are duplicate name Strings within an object,
lexically preceding values for the same key shall be overwritten."

- Rob