rénovation devrait begin_array mais a été begin_object à la ligne 1 de la colonne 2 chemin $

Je suis en apprentissage de rénovation à la suite d'une vidéo youtube
mais pour l'instant je suis coincé. Il m'indique une erreur "de rénovation prévu begin_array mais a été begin_object à la ligne 1 de la colonne 2 chemin $"
Je vais essayer d'obtenir des données json à partir de ce site.
http://servicio-monkydevs.rhcloud.com/clientes/

Voici mon code

MainActivity.java

resultadoTextView = (TextView) findViewById(R.id.Resultado);
    Retrofit restAdapter = new Retrofit.Builder()
            .baseUrl("http://servicio-monkydevs.rhcloud.com")
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    ClienteService service = restAdapter.create(ClienteService.class);
    Call<Cliente> call = service.getCliente();
    call.enqueue(new Callback<Cliente>() {
        @Override
        public void onResponse(Call<Cliente> call, Response<Cliente> response) {
            if(response.isSuccessful()) {
                resultadoTextView.setText(call.toString());
            }else{
                resultadoTextView.setText("algo paso");
            }
        }

        @Override
        public void onFailure(Call<Cliente> call, Throwable t) {
            resultadoTextView.setText(t.getMessage());
        }
    });

ClientService.java

public interface ClienteService {
  @GET("/clientes")
  Call<Cliente> getCliente();
}

Client.java

public class Cliente {
private int id;
private String name;
private String username;
private String email;
private String phone;
private String website;
private String photo;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
@Override
public String toString() {
return "Cliente{" +
"id=" + id +
", name='" + name + '\'' +
", username='" + username + '\'' +
", email='" + email + '\'' +
", phone='" + phone + '\'' +
", website='" + website + '\'' +
", photo='" + photo + '\'' +
'}';
}}

Ce que je fais mal?

Mise à JOUR

J'ai fait ces changements

public class Cliente {
@SerializedName("id")
private int id;
@SerializedName("name")
private String name;
@SerializedName("username")
private String username;
@SerializedName("email")
private String email;
@SerializedName("phone")
private String phone;
@SerializedName("website")
private String website;
@SerializedName("photo")
private String photo;
...

Et ce dans l'interface

public interface ClienteService {
@GET("/clientes")
Call<List<Cliente>> getCliente();
}

Et ce dans le MainActivity comme vous le dites

 Call<List<Cliente>> call = service.getCliente();
call.enqueue(new Callback<List<Cliente>>() {
@Override
public void onResponse(Call<List<Cliente>> call, Response<List<Cliente>> response) {
if(response.isSuccessful()) {
resultadoTextView.setText(call.toString());
}else{
resultadoTextView.setText("algo paso");
}
}
@Override
public void onFailure(Call<List<Cliente>> call, Throwable t) {
resultadoTextView.setText(t.getMessage());
}
});

Mais maintenant il m'indique cette erreur:
"retrofit2.executorCallAdapterFactory$ExecutorCallbackCall@6a3dd44"

Il me montre dans cette ligne

...
if(response.isSuccessful()) {
resultadoTextView.setText(call.toString());  <-- HERE
}else{
...
  • l'erreur est vrai. vous pouvez vérifier si vous avez des connaissances sur tableau json et l'objet de la syntaxe. Votre résultat json qui commence par " ["qui est un tableau de la syntaxe.
  • Pouvez-vous ajouter le lien vers le you tube vidéo que vous l'avez mentionné?
InformationsquelleAutor eduarboy | 2016-06-28