Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion fromJson with no-attribut element

Received: by 10.224.196.196 with SMTP id eh4mr8783325qab.5.1334165759158;
        Wed, 11 Apr 2012 10:35:59 -0700 (PDT)
X-BeenThere: google-gson@googlegroups.com
Received: by 10.229.246.18 with SMTP id lw18ls1039319qcb.5.gmail; Wed, 11 Apr
 2012 10:35:57 -0700 (PDT)
Received: by 10.224.107.199 with SMTP id c7mr598211qap.8.1334165757918;
        Wed, 11 Apr 2012 10:35:57 -0700 (PDT)
Received: by 10.224.70.133 with SMTP id d5msqaj;
        Wed, 11 Apr 2012 04:22:33 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.180.36 with SMTP id i24mr1595651yhm.3.1334143353638; Wed,
 11 Apr 2012 04:22:33 -0700 (PDT)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
 mvincent...@gmail.com designates internal as permitted sender)
 smtp.mail=mvincent...@gmail.com; dkim=pass
 header...@gmail.com
Received: by m16g2000yqc.googlegroups.com with HTTP; Wed, 11 Apr 2012 04:22:33
 -0700 (PDT)
Date: Wed, 11 Apr 2012 04:22:33 -0700 (PDT)
User-Agent: G2/1.0
X-HTTP-Via: 1.1 tinyproxy (tinyproxy/1.6.3)
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.19 (KHTML, like
 Gecko) Chrome/18.0.1025.152 Safari/535.19,gzip(gfe)
Message-ID: <38b91057-218c-40a5-b1fd-987cb313fdcd@m16g2000yqc.googlegroups.com>
Subject: [GSON] fromJson with no-attribut element
From: yodamad <mvincent...@gmail.com>
To: google-gson <google-gson@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi,

 i'm trying to extract data from a json file but ther's a weird part
in it.
Here is an exemple :

	"members":[
	"name":"John",
	"email":"j...@gson.com"
	{"children":[{"name":"Bob}]},
	{"address":"Melrose Place",
	"city":"Los Angeles",
	"state":"CA"}]

How can I extract to an Address object the part {"address":"Melrose
Place", "city":"Los Angeles", "state":"CA"} as it doesn't have an
attribute name.

In my Member class, I cannot annotate the address attribute with
@SerializedName because I don't have an name for it.

Is there a way to add this mapping to serialization context ?

Thanks in advance,