pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Brind <bri...@brindy.org.uk>
Subject Re: Preferences class
Date Wed, 08 Apr 2009 07:40:29 GMT
Hi Sandro,

My understanding of JSON (based on this site: http://json.org/ ) is that the
key can be any quoted string with the following rules:
*string**""*
*"* *chars* *"**chars**char*
*char chars**char**any-Unicode-character-*
    *except-**"**-or-**\**-or-*
    *control-character*
*\"*
*\\*
*\/*
*\b*
*\f*
*\n*
*\r*
*\t*
*\u* *four-hex-digits*
I seem to remember, last time I looked at the code, that Pivot's JSON parser
allows for unquoted strings and strings quoted using other characters.  I
think we should be sticking to the 'specification' as defined on
http://www.json.org/

This means that the existing JSON based preferences files are incorrect.
 They currently look like this:

{
    key1 : "Value1",
    key2 : "Value2"
}

Really they should look like this:
{
    "key1" : "Value1",
    "key2" : "Value2"
}

Cheers,
Chris



2009/4/8 Sandro Martini <sandro.martini@gmail.com>

> Hi Greg,
> I'm converting Preferences to the new stub (using the new version of
> JSONSerializer), but now i have some little problems, starting with
> this:
>
> putting a sample value like
>           prefs.put("accent'inside", "accent'inside");
> doesn't work anymore (ok, it's a strange key, but is it a right json
> key ?), and gives me an
> Illegal identifier character.
> from the split method ... ok, but what do you think on add more detail
> to this type of errors, making it like
> Illegal identifier character ' in key "accent'inside"
> and the same thing also for values ...
>
> Ah, and also the line with
>           prefs.put("java.util.Date.toString", new
> java.util.Date().toString());
> doesn't work, and gives
> Invalid path.
> also here more infos on the problem could help ...
>
> Trying to handle these strange keys inside a "" block (like json
> strange keys if i remember well) maybe could help with this type of
> values ... if a valid json file could contains also these.
> Ok, but it's not a problem, it's only to see if could be fixed (if it
> makes sense) ...
>
>
> After commenting these lines, all worked, but now i have to move my
> methods inside the new LoadTask, SaveTask, etc ...
>
>
> Ok, but now here it's too late, i have to go in bed, let's continue later.
>
>
> Thanks,
> Sandro
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message