shau-lok / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

JsonParseException: Expecting object found: "anyType" #376

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
11-02 22:42:06.774: WARN/System.err(270): com.google.gson.JsonParseException: 
Expecting object found: "anyType"

My code:
gson.fromJson(response.toString(), CollectionCategory.class)

Data: response.toString()

"anyType{
CollectionCategory=anyType{CategoryId=531aca3d-7710-427f-8592-3591d0f37bf5; 
Description=Category1; Name=Category1; }; 
CollectionCategory=anyType{CategoryId=b9b3cd04-bc7c-40bc-af5c-42b63f2b5784; 
Description=Category2; Name=Category2; }; 
}"

Class Definition:
public class CollectionCategory {
    public UUID CategoryId;
    public String Name;
    public String Description;
}

Original issue reported on code.google.com by haidaocht on 2 Nov 2011 at 2:56

GoogleCodeExporter commented 9 years ago
I hate to break it to you, but that isn't JSON.

Original comment by limpbizkit on 3 Nov 2011 at 1:45

GoogleCodeExporter commented 9 years ago
Thanks, it's from Microsoft WCF Service.

Anyone hit same issue? 
Is there a workaround for this issue?

Original comment by haidaocht on 3 Nov 2011 at 2:34

GoogleCodeExporter commented 9 years ago
Use a different library. GSON only parses JSON.

Original comment by limpbizkit on 4 Nov 2011 at 4:09