Problem deserializing Json object with VRaptor4

1

Good afternoon, people.

I'm having problems deserializing object json with VRaptor4.

Doing some testing, you notice a situation:

I'm using curl only to test the service, but when I make this request ex: curl -v -H "Content-Type: application / json" -d "{" id ": 1," description ":" json test "}" link

The error occurs but if I take the spaces of the characters the json object, for example: in the description I put together the value Test json for Testjson deserializer works without problem some.

Can you help me if this is happening for some of my failures or if it could be a problem with 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.caelum.vraptor.serialization.gson.GsonDeserialization $ Proxy $ _ $$ _ WeldClientProxy.deserialize (Unknown   Source) at   br.com.caelum.vraptor.observer.DeserializingObserver.deserializes (DeserializingObserver.java:91)

    
asked by anonymous 06.05.2016 / 18:24

0 answers