title: How to parse a Json to another activity
body: <p>I have 3 activities that require a Json to show data, the second activity get the values from the main activity based on its ID, I need to pass that Json to each one of them so it can receive the data, How can I pass it through intent to another activity? I'm very new to android development, I've read some questions related to this case, but I didn't understand it very well.</p>
  
  <pre><code>public void updateList() {
  
  
          feedListView= (ListView) findViewById(R.id.custom_list);
          feedListView.setVisibility(View.VISIBLE);
          progressbar.setVisibility(View.GONE);
          feedListView.setAdapter(new CustomListAdapter(this, feedList));
  
  
          feedListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; a, View v, int position, long id) {
  
  
                  TextView clienteId = (TextView) v.findViewById(R.id.clienteId);
                  System.out.println("Clicou  " + clienteId.getText());
  
                  int idCliente = Integer.valueOf(String.valueOf(clienteId.getText()));
  
                  for(int x=0; x&lt;feedList.size(); x++) {
  
  
                      if(feedList.get(x).getId_rm() == idCliente) {
  
                          ArrayList&lt;ClientesContatosModel&gt; contatosDoCliente = new ArrayList&lt;ClientesContatosModel&gt;();
  
                          System.out.println(feedList.get(x).getNome() + " tem " + feedList.get(x).getContatos().size() + " contatos");
  
                          if(feedList.get(x).getContatos().size() &gt; 0) {
  
                              System.out.println("Valor de x " + x);
  
                              for(int y=0; y&lt;feedList.get(x).getContatos().size(); y++) {
  
                                  ClientesContatosModel mClientesContatosModel = new ClientesContatosModel();
  
                                  mClientesContatosModel.setNomeContato(feedList.get(x).getContatos().get(y).getNomeContato() );
                                  mClientesContatosModel.setCargo(feedList.get(x).getContatos().get(y).getCargo());
  
                                  contatosDoCliente.add(mClientesContatosModel);
  
                              }
  
                          }
  
  
                          Intent intent = new Intent(FeedListActivity.this, FeedDetailsActivity.class);
                          intent.putExtra("data", contatosDoCliente);
  
  
                          startActivity(intent);
  
                      }
  
                  }
  
              }
  
          });
  
  
  
      }
  </code></pre>
  
  <p>Parse Json:</p>
  
  <pre><code>public void parseJson(JSONObject json) throws JSONException {
  
          try {
  
              JSONArray dados = json.getJSONArray("dados");
              feedList = new ArrayList&lt;ClientesModel&gt;();
              // parsing json object
              for (int i = 0; i &lt; dados.length(); i++) {
  
                  JSONObject item = dados.getJSONObject(i);
                  ClientesModel mClientesModel = new ClientesModel();
  
  
                  mClientesModel.setId_rm(item.optInt("id"));
                  mClientesModel.setNome(item.optString("nome"));
                  mClientesModel.setTipo_pessoa(item.optString("tipo_pessoa"));
                  mClientesModel.setInformacoes_adicionais(item.optString("informacoes_adicionais"));
                  mClientesModel.setCpf(item.optString("cpf"));
                  mClientesModel.setCnpj(item.optString("cnpj"));
  
                  feedList.add(mClientesModel);
  
  
                  JSONArray contatos = item.getJSONArray("contatos");
  
                  if (contatos != null) {
  
                      contatoList = new ArrayList&lt;ClientesContatosModel&gt;();
  
                      for (int j = 0; j &lt; contatos.length(); j++) {
  
  
                          JSONObject data = contatos.getJSONObject(j);
  
                          ClientesContatosModel mClientesContatoModel = new ClientesContatosModel();
  
                          mClientesContatoModel.setId_rm(data.optInt("id_rm_cliente"));
                          mClientesContatoModel.setNomeContato(data.optString("nome"));
                          mClientesContatoModel.setCargo(data.optString("cargo"));
  
                          contatoList.add(mClientesContatoModel);
  
                          JSONArray telefone = data.getJSONArray("telefones");
  
                          if (telefone != null) {
  
                              telefoneList = new ArrayList&lt;ContatosTelefoneModel&gt;();
  
                              for (int k = 0; k &lt; telefone.length(); k++) {
  
  
                                  JSONObject tel = telefone.getJSONObject(k);
  
                                  ContatosTelefoneModel mContatosTelefoneModel = new ContatosTelefoneModel();
  
                                  mContatosTelefoneModel.setId_rm(tel.optInt("id_rm_telefone"));
                                  mContatosTelefoneModel.setNumero(tel.optString("numero"));
                                  mContatosTelefoneModel.setTipo(tel.optString("tipo"));
  
                                  telefoneList.add(mContatosTelefoneModel);
  
                              }
  
                          }
  
  
                          mClientesModel.setContatos(contatoList);
                          mClientesContatoModel.setTelefone(telefoneList);
  
                          System.out.println(mClientesContatoModel);
                      }
  
  
                  }
              }
          } catch (JSONException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>What I'm trying to do is:</p>
  
  <pre><code>intent.putExtra("json", (java.io.Serializable) new JSONArray().toString());
  </code></pre>
  
  <p>and in my second activity:</p>
  
  <pre><code>Bundle parametros = getIntent().getExtras();
  
          String jsonArray = parametros.getString("json");
  
          try {
              JSONArray array = new JSONArray(jsonArray);
  
              System.out.println("json array " + array.toString(2));
          } catch (JSONException e) {
              e.printStackTrace();
          }
  </code></pre>
  
  <p>How can I get "telefones" from the main json and pass it in the second activity?</p>