Getting error:
java.lang.IllegalArgumentException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: N/A; line: -1, column: -1]
and
Caused by: com.google.appengine.repackaged.org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: N/A; line: -1, column: -1]
Samples of my objects:
@PersistenceCapable public class User { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; public Key getKey() {return this.key; } public User() {} public Address getAddress() {return address;} public void setAddress(Address address) {this.address = address;} @Persistent private Address address; } @PersistenceCapable public class Address { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private String otherProperty;
Using the google client javascript api tool ( https://code.google.com/p/google-api-javascript-client/ )
Connect to the endpoint of the Google Cloud generated in eclipse. -Using api explorer, I can add users with addresses without problems (localhost: 8888 / _ah / api / explorer).
If the address is not used, the call works as expected:
var request = gapi.client.userendpoint.user.insert({ firstName : "test", lastName : "test", emailAddress : "test", phoneNumber : "test" }); console.log(request); request.execute(function(resp){console.log(resp);})
However, when called with an address, it fails:
var request2 = gapi.client.userendpoint.user.insert({ firstName : "test", lastName : "test", emailAddress : "test", clubName : "test", ahaNumber : "test", phoneNumber : "test", address: { attention : "test", line1 : "test", line2 : "test", line3 : "test", state : "test", postalCode : "test", country : "test" } }); console.log(request2); request2.execute(function(resp){console.log(resp);})
with an error:
POST http://localhost:8888/_ah/api/rpc 500 (Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: N/A; line: -1, column: -1])
Any feedback is appreciated!
I feel that I am missing something obvious ...