Android Set Name with brackets in the body json parameter

0

I'm having the following problem: I'm using the Android Rest API library link , and I'm trying a post, but the post only accepts a single parameter, which I am trying to send as an object, Json expects to receive the following:

public class User(){

  int USER_ID[Id]
  String USER_nome[nome]
}

Since I can not put brackets as the name of this attribute on my object, then how do I get this object sent?

    
asked by anonymous 10.09.2015 / 15:23

1 answer

0

Túlio F.:

Here are some of the Body parameters the server is waiting for:

mobile_session [token],
mobile_session [email]

This is a class I created now to illustrate how I'm doing

@Rest(rootUrl = "http://demo2601066.mockable.io/", converters = {MappingJackson2HttpMessageConverter.class,FormHttpMessageConverter.class})
public interface TKSAL {
    @Post(value = "testeJonathan")
    Resposta criarmetodo(Envio envio);
}

This is my Shipping Object:

@JsonIdentityReference
public class Envio {
    @JsonProperty("mobile_session[token]")
    Long token;

    @JsonProperty("mobile_session[email]")
    String email;
}

Note that I can not put variable_name as the name of variable mobile_session [token] because the notation does not accept brackets as a variable name, so how do I do this?

    
10.09.2015 / 16:12