Surprisingly gson doesn't seem to escape string values and haven't
found a utility in the code to do this.
I think it should automatically do this as any recursed objects on
serialization are potentially problematic.
Can we check this in immediately on the toString() method? otherwise I
will have to use a different library for serialization which is a bit
mad.
On Sep 2, 8:42 pm, Ian Clarke <
ian.cla...@gmail.com> wrote:
> On Wed, Sep 2, 2009 at 2:03 PM, jack<
jackwum...@gmail.com> wrote:
> > i understand json uses bracket "[" to group objects. so if my object
> > has a string value which contains brackets "..[..]..", could it cause
> > problems for the gson parser when de-serializing json strings? thanks.
>
> Jack, JSON uses square brackets for the start and end of JSON arrays
> (which are like lists in other languages).
>
> Using these square brackets inside JSON strings won't be a problem.
> The only characters you have to worry about using inside a string are
> " and \, these must be escaped. I would guess that thisescapingis
> handled automatically by Gson but I haven't tried it personally.
>
> You can read about the JSON spec here, its pleasingly simple:
http://json.org/
>
> Ian.
>
> --
> Ian Clarke
> CEO, Uprizer Labs
> Email:
i...@uprizer.com
> Ph:
+1 512 422 3588
> Fax:
+1 512 276 6674