@POST array with retrofit
<p>I need help with sending @POST request. Right now my post method looks like this :</p>

<pre><code>@FormUrlEncoded

    @POST("/api/mobile/{language}/{apiVersion}/beacons/try-save-settings")
    void trySaveBeaconParams(@Field("beacon_id") long beaconId,
                             @Field("password") String password,
                             @Field("ib[turn_on]") int turn_on,
                             @Field("ib[minor]") int minor ,
                             @Field("ib[major]") int major ,
                             @Field("ib[tx_power]") int tx_power ,
                             @Field("ib[interval]") int interval,
                             @Field("ib[secure_uuid]") int secure_uuid,
                             @Field("euid[turn_on]") int euid_turn_on,
                             @Field("euid[interval]") int euid_interval,
                             @Field("euid[tx_power]") int euid_tx_power,
                             @Field("euid[namespace]") String euid_namespace,
                             @Field("euid[instance]") String euid_instance,
                             @Field("eeid[turn_on]") int eeid_turn_on,
                             @Field("eeid[interval]") int eeid_interval,
                             @Field("eeid[tx_power]") int eeid_tx_power,
                             @Field("eurl[turn_on]") int eurl_turn_on,
                             @Field("eurl[interval]") int eurl_interval,
                             @Field("eurl[tx_power]") int eurl_tx_power,
                             @Field("eurl[url]") String eurl_url,
                             @Field("etlm[turn_on]") int etlm_turn_on,
                             @Field("etlm[interval]") int etlm_interval,
                             @Field("etlm[tx_power]") int etlm_tx_power,
                             @Field ("sleep_modes[]") List&lt;SleepMode&gt; model,
                             Callback&lt;BasicResponse&lt;Object&gt;&gt; callback);
</code></pre>

<p>The problem is with array sleep_mode. When I send it as I wrote I'm sending data like this : <a href="https://i.stack.imgur.com/s2qSQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s2qSQ.jpg" alt="RESPONSE_UNCORRECT"></a></p>

<p>While I need to send in format like that :</p>

<p><a href="https://i.stack.imgur.com/pYzWb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pYzWb.jpg" alt="enter image description here"></a></p>

<p>I tried to do it with @Body but it hasn't worked then. ANy help please ? Thanks in advance.
My SleepMode.class :</p>

<pre><code>@Table(name = "SleepMode")
public class SleepMode {

    @Column
    @Expose
    @SerializedName("turn_on")
    public int turn_on;
    @Column
    @Expose
    @SerializedName("time_from")
    public String time_from;
    @Column
    @Expose
    @SerializedName("time_to")
    public String time_to;
</code></pre>

<p>--------------------------- EDIT , VERSION WITH "@BODY"-------------------------</p>

<pre><code>@POST("/api/mobile/{language}/{apiVersion}/beacons/try-save-settings")
    void trySaveBeaconParams(
            @Body EonBeaconModel model,

            Callback&lt;BasicResponse&lt;Object&gt;&gt; callback);
</code></pre>

<p>EonBeacon.class</p>

<pre><code>@Table(name = "eonBeacon")
public class EonBeaconModel extends Model {
    @Column(unique = true, onUniqueConflict = Column.ConflictAction.REPLACE, index = true)
    public long beacon_id;
    @Column
    public long bridge_id;
    @Column
    public long mesh_id;
    @Column
    public String name;
    @Column
    public String location;
    @Column
    public String mac_address;
    @Column
    public String firmware;
    @Column
    public String pcb_revision;
    @Column
    public int battery_level;
    @Column
    public String password;
    @Column
    public String assigned_bridge_id;

    @Column(name="Eeid")
    public Eeid eeid;
    @Column(name="Etlm")
    public Etlm etlm;
    @Column
    public Euid euid;
    @Column(name="Eurl")
    public Eurl eurl;
    @Column(name="Ib")
    public IbModel ibBeaconModel;
    @Column
    public String jsonIB;
    @Column
    public String jsonEeid;
    @Column
    public String jsonEtlm;
    @Column
    public String jsonEuid;
    @Column
    public String jsonEurl;
    @Column
    public boolean isBeacon;
    @Column(name="sleep_modes")
    public List&lt;SleepMode&gt; sleep_modes;
    @Column
    public String jsonSleep;
</code></pre>

<p>This is how i create callback :</p>

<pre><code>@Subscribe
    public void validateNewBeaconData(ValidateNewBeaconDataCommand command) {
        Callback&lt;BasicResponse&lt;Object&gt;&gt; callback = new Callback&lt;BasicResponse&lt;Object&gt;&gt;() {
            @Override
            public void success(BasicResponse&lt;Object&gt; basicResponse, Response response) {
                if (ResponseStatus.SUCCESS.statusCode == basicResponse.status) {
                    EventBus.post(new BeaconsSettingsValidatedEvent());
                    Log.e(TAG, "success: ");
                }
                else {
                    EventBus.post(new NetworkFailureEvent(ResponseStatus.getByStatus(basicResponse.status), basicResponse.status_msg));
                    Log.e(TAG, "failure validate: " );

                }
            }

            @Override
            public void failure(RetrofitError error) {
                EventBus.post(new NetworkFailureEvent(ResponseStatus.NETWORK_ERROR, messageString));
                Log.e(TAG, "failure: " + error.getCause() );

            }
        };
        service.trySaveBeaconParams(command.model
                ,
             callback);


    }
</code></pre>

<p>Validate class :</p>

<pre><code>public class ValidateNewBeaconDataCommand extends ApiCommand {
   public EonBeaconModel model;


    public ValidateNewBeaconDataCommand(EonBeaconModel model) {

       this.model=model;
    }
}
</code></pre>

<p>and this is how I create a request :</p>

<p>EventBus.post(new ValidateNewBeaconDataCommand(beaconModel));</p>

<p>THANKS and sorry for so much code :)</p>