Problem deserving Json object with Vraptor4

Asked

Viewed 312 times

1

Good afternoon Personal.

I am having problems deserealizing json object with Vraptor4.

Taking some tests, you realize a situation:

I am using Curl only to test the service, but when I do this request: Curl -v -H "Content-Type: application/json" -d " {"id":1,"Description":"Json test"}"http://localhost:8080/meRest/save

the error occurs but if I take the spaces of the characters the object json, for example: in the description I add the value Json test for Testejson the deserializer works without any problem.

They can help me if it is occurring for some fault of mine or if it can be some problem in Vraptor4?

My method:

@Post
@Consumes("application/json")
public void salvarEvento(Anotacao anotacao) {
    System.out.println(anotacao.getDescricao());
    result.nothing();
}

Class:

public class Anotacao {
  @Id @GeneratedValue
  private Long id;
  private String descricao;
  @ManyToOne
  private Evento evento;
  @ManyToOne
  private Usuario usuario;
}

Error:

br.com.Caelum.vraptor.view.Resultexception: Unable to deserialize data at br.com.Caelum.vraptor.serialization.gson.Gsondeserialization.deserialize(Gsondeserialization.java:151) at br.com.Caelum.vraptor.serialization.gson.Gsondeserialization$Proxy$_$_Weldclientproxy.deserialize(Unknown Source) at br.com.Caelum.vraptor.Observer.DeserializingObserver.deserializes(Deserializingobserver.java:91)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.