here is the server from which i get json: http://getshexml.azurewebsites.net/Client.svc/getClientsjson

MainActivity{ String json = "[\"{\\\"phone\\\": \\\"380554\\\", \\\"fio\\\": \\\"VLAD ZAECH\\\",\\\"about\\\":\\\"BASTARD BAD PM\\\"}\",\"{\\\"phone\\\": \\\"38065664\\\", \\\"fio\\\": \\\"Nastya\\\",\\\"about\\\":\\\"BEST PM EVER\\\"}\",\"{\\\"phone\\\": \\\"123456789123\\\", \\\"fio\\\": \\\"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\\",\\\"about\\\":\\\"\\\"}\",\"{\\\"phone\\\": \\\"\\\", \\\"fio\\\": \\\"\\\",\\\"about\\\":\\\"Who is it?\\\"}\"]"; GsonBuilder builder = new GsonBuilder(); Gson gson = builder.create(); Type datasetListType = new TypeToken<Collection<DataDTO>>() { }.getType(); Log.d("MyLog", "тут вылетит"); List<DataDTO> data = gson.fromJson(json, datasetListType); Log.d("MyLog", "не вылетело"); for (DataDTO dataset : data) { Log.d("MyLog", dataset.getPhone()); Log.d("MyLog", dataset.getFio()); Log.d("MyLog", dataset.getAbout()); } } DataDTO{ private String phone; private String fio; private String about; public DataDTO() { } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getFio() { return fio; } public void setFio(String fio) { this.fio = fio; } public String getAbout() { return about; } public void setAbout(String about) { this.about = about; } 

on the log flew out he flies tell me what's wrong and tell me some kind of literature for working with the server in android and pars json

Closed due to the fact that off-topic participants cheops , Bald , aleksandr barakin , lexxl , user194374 4 Aug '16 at 7:54 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - cheops, Bald, lexxl, Community Spirit
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • staktrays where? - Vladyslav Matviienko
  • Thank you, I’m not the only one who thinks that this is a json junk. List <DataDTO> data = gson.fromJson (json, datasetListType); - Dima Zhylko

1 answer 1

Anyways json turned out to be crooked thanks @metalurgus. I used this example for the pars code: http://www.studytrails.com/java/json/java-google-json-serializing-collections.jsp