Well, it's not clear what you're trying to do or how you're feeding
the data to the JSON parser.  The first example should work (based on
very brief examination) if the starting/ending quotes you display have
been supplied in printing the string and don't actually exist IN the
string.  Otherwise, what you have is a character string, not JSON
data.

In the second example the outer quotes are missing, so that confuses
me vs the first.  Additionally, the entire value of "GetMemberResult"
is a single character string which would need to be recursively parsed
to derive it's JSON values.

On May 15, 3:50 pm, Patrick Cornish <patrick.corn...@gmail.com> wrote:
> I have a test web MVC web service that is returning JSON data.   I am
> not able to deserialze the data returned:
>
> This doesn't work (BodyStyle = Bare):
>
> "{\"MemberID\":\"88831472\",\"MemberUserName\":\"Yang Yi\",
> \"MemberFirstName\":\"Yang\",\"MemberFamilyName\":\"Liu\",
> \"ThumbnailFilename\":\"88831472_Image_1.jpg\"}"
>
> This doesn't work (BodyStyle = Wrapped):
>
> {"GetMemberResult":"{\"MemberID\":\"88831472\",\"MemberUserName\":
> \"Yang Yi\",\"MemberFirstName\":\"Yang\",\"MemberFamilyName\":\"Liu\",
> \"ThumbnailFilename\":\"88831472_Image_1.jpg\"}"}
>
> I created the string manually which works:
>
> "{\"GetMemberResult\":{\"MemberFamilyName\":\"Liu\",\"MemberFirstName
> \":\"Yang\",\"MemberID\":\"88831472\",\"MemberUserName\":\"Yang Yi\",
> \"ThumbnailFilename\":\"88831472_Image_1.jpg\"}}"
>
> According to what I have learned so far I expected all three to be
> valid JSON data.  Can anyone tell me why I can't deserialize the first
> two examples?  I have tried:
>
> org.json.JSONObject
> and
> com.google.gson.*
>
> Both have the same issue with the JSON data.
>
> Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to