Re: [Json] Leading and trailing whitespace

"Jim Schaad" <> Tue, 11 June 2013 00:17 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 51C5521F934B for <>; Mon, 10 Jun 2013 17:17:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -3.599
X-Spam-Status: No, score=-3.599 tagged_above=-999 required=5 tests=[AWL=0.000, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id vmLdKAcQ8E2A for <>; Mon, 10 Jun 2013 17:17:26 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 74AEF21F9412 for <>; Mon, 10 Jun 2013 17:17:26 -0700 (PDT)
Received: from Philemon ( []) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: by (Postfix) with ESMTPSA id 342D238EF2; Mon, 10 Jun 2013 17:17:16 -0700 (PDT)
From: "Jim Schaad" <>
To: "'Paul Hoffman'" <>
References: <06c101ce6625$0f891bf0$2e9b53d0$> <>
In-Reply-To: <>
Date: Mon, 10 Jun 2013 17:16:24 -0700
Message-ID: <06e901ce6638$e8f27a90$bad76fb0$>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQIjA7ejHysocqIyb9p/XvW1gI4I3gIdfG2fmHV8G1A=
Content-Language: en-us
Subject: Re: [Json] Leading and trailing whitespace
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Tue, 11 Jun 2013 00:17:32 -0000

My intention here has nothing to do with canonicalization and everything to
do with what constitutes a valid string from a parsing perspective.

Consider for example the case of a text file which consists of a JSON text
string with a trailing CRLF in the file.  If trailing whitespace is allowed
then the entire text file is a legal JSON text string.  If the trailing
whitespace is not allowed then it is not a legal JSON text string.  I am
just trying to clarify which is true.

This makes a difference with the argument about moving all of the values to
the top level since then the string (ignore the quotes) "   true \r\n"
cannot be matched if you just want to say it is a Boolean literal (i.e. the
non-terminator true).  Instead you need to say that it can have whitespace
on either side of it.

I will agree that the original intention probably is just a question of
academic interest.  The real question I should have asked would be are
people taking advantage of the fact.

That is the question of what about normal whitespace.

I think there is a question about parsers that would accept the string


As I believe there are some that will (stop when you get to the end of the
object) and some that will not.


> -----Original Message-----
> From: Paul Hoffman []
> Sent: Monday, June 10, 2013 3:04 PM
> To: Jim Schaad
> Cc:
> Subject: Re: [Json] Leading and trailing whitespace
> <no hat>
> On Jun 10, 2013, at 2:54 PM, "Jim Schaad" <> wrote:
> > The current specification allows for arbitrary whitespace to occur
> > before and after an array or object.  I would like to know if this is
> > what was intended to begin with or not.
> Why is the "intention" important?
> > There are two different things that could be done about this (one of
> > which would potentially be necessary if you allowed all values in a
> text.
> Why should something "be done about this"? I think you are leading into
> canonicalization, but that's not part of RFC 4627, so introducing it seems
like a
> pretty massive change.
> Having said that, knowing your intention would be useful here.
> --Paul Hoffman=