Hello to all. There is such:
{ "status": "ok", "meta": { "count": 1 }, "data": { "raz": { "dva": { "tri": { "results": 1234, "more1": 5678, "more2": "abc" ... } } } } } How to bring all this into a more comfortable look?
ArrayList , HashMap Ie, I don’t understand what kind there should be a class with so many attachments, so that I can only extract from the whole result:
private String results; ... public String getResults() { return results; } I apologize for such an incomprehensible explanation, I do not know how to present everything correctly yet.
Now it looks like this:
public class Json extends AsyncTask<String, String, String> { private Context context; private String method; private String url; private String[] array; private String results; public Json (Context context, String method, String url, String[] array){ this.context = context; this.method = method; this.url = url; this.array = array; } @Override protected void onPreExecute() { super.onPreExecute(); } protected String doInBackground(String... args) { List<NameValuePair> params = new ArrayList<NameValuePair>(); try { for (int i = 0; i < array.length; i++) { String[] s = array[i].split("="); params.add(new BasicNameValuePair(s[0], s[1])); } JSONObject json = jParser.makeHttpRequest(url, method, params); results = json.toString(); } catch (Exception e) { e.printStackTrace(); } return null; } protected void onPostExecute(String string) { Toast.makeText(Main.this, results, Toast.LENGTH_LONG).show(); } } Where to change / add?