Re: [Cppcms-users] Small issues in cppcms 1.x.x
Brought to you by:
artyom-beilis
|
From: Daniel V. <chi...@gm...> - 2010-04-09 15:32:12
|
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
>
>
>
|