Re: [Cppcms-users] Small issues in cppcms 1.x.x
Brought to you by:
artyom-beilis
|
From: Artyom <art...@ya...> - 2010-04-09 15:48:46
|
Ok, I see, you have a point...
Indeed it either should be json::text and accept text only or json::value
and accept values as well.
In any case... My json parser receives superset of json. It allows
C++ style comments // and allows additional commas like {"foo","bar",}
So I reverted the change in trunk... it receives values back again
Artyom
--- On Fri, 4/9/10, Daniel Vallejos <chi...@gm...> wrote:
> From: Daniel Vallejos <chi...@gm...>
> Subject: Re: [Cppcms-users] Small issues in cppcms 1.x.x
> To: "Artyom" <art...@ya...>
> Cc: cpp...@li...
> Date: Friday, April 9, 2010, 6:32 PM
> Hello Artyom,
>
> The RFC says:
>
> A JSON text is a serialized
> object or array.
>
> JSON-text
> = object / array
>
> Then, you are right, JSON-text is an Object or Array only.
>
> But, the RFC says about Values:
>
> 2.1. Values
>
> A JSON value
> MUST be an object, array, number, or string, or one of
> the following
> three literal names:
>
> false null
> true
>
> Therefore the string "Hello World" is a valid Json Value
> syntax. I think
> that the cppcms::json::value parser should accept a valid
> Json Value
> syntax.
>
> If you had a class "cppcms::json::json_text" or similar,
> the parser of
> this type should only accept Object or Array syntax. As you
> have pointed
> out.
>
> Daniel.
>
>
>
> On Thu, 2010-04-08 at 13:43 -0700, Artyom wrote:
> > Ok I've got confuses with data on json.org site.
> >
> > > 3) Json parser. The json parser fail to parse a
> simple
> > > string. I expect
> > > that the following code snippet print "ok", but I
> get
> > > "err".
> > >
> > > string
> json_str("\"Hello
> > > World\");
> > >
> cppcms::json::value v;
> > >
> stringstream ss;
> > > ss <<
> json_str;
> > >
> >
> > The string "Hello World" is not valid json. See
> RFC-4627
> >
> > http://www.ietf.org/rfc/rfc4627.txt
> >
> > Json is either Object or Array, single values is not
> valid JSON.
> > I reverted incorrect changes. Json parses should not
> accept such strings.
> >
> > Artyom
> >
> >
> >
>
>
>
|