title: Parsing data from local JSON file to java android
body: <p>After following a number of examples online, I've got confused so rather hope someone can explain to me what I do next and point me in the right direction.</p>
  
  <p>Within my app, I've created a function to load my JSON file, which is in my assets folder.</p>
  
  <pre><code>public String loadJSONFromAsset() {
      String json = null;
      try {
  
          InputStream is = getAssets().open("animals.json");
  
          int size = is.available();
          byte[] buffer = new byte[size];
          is.read(buffer);
          is.close();
          json = new String(buffer, "UTF-8");
      } catch (IOException ex) {
          ex.printStackTrace();
          return null;
      }
      return json;
  
  }
  </code></pre>
  
  <p>So then in onCreate, I have the following line</p>
  
  <pre><code>JSONObject obj = new JSONObject();
  </code></pre>
  
  <p>I'm quite confused as to how this is calling the loadJSONFromAsset(), as other examples I had seen did this, but this was the approach that I understood, until I got to here. For example, how would I output the JSON into a TextView I have created?</p>
  
  <p>Thanks</p>
  
  <p>Edit - Sorry forgot the JSON!</p>
  
  <pre><code>[
  {"zooLocation":"Penguin Bay", "animalName":"Humboldt Penguin (Spheniscus humboldti)", "status":"Vulnerable", "naturalHabitat":"Coast of Chile and Peru in South America on islands and rocky areas in burrows", "food":"Small fish", "animalInfo":"Humboldt Penguins grow to 56-70cm long and a weight of up to 4.9kg. The penguins can be distinguished by their spot patterns on their belly", "moreAnimalInfo":"", "interestingFacts":"Penguins can propel themselves at speeds up to 17 mph underwater", "helpfulHints":"", "todaysFeed":"Come and see us at Penguin Bay at 11.30am and 2.30pm - Please check around the park as these times may change"},
  {"zooLocation":"Otters and Reindeer", "animalName":"Asian Short-Clawed Otter", "status":"Vulnerable", "naturalHabitat":"Throughout a large area of Asia in wetland systems in freshwater swamps, rivers, mangroves and tidal pools", "food":"A variety of animals living near to the waters edge, including crabs, mussels, frogs and snails", "animalInfo":"Vulnerable in their natural habitat, these are the smallest species of otter in the world and are perfectly at home on land or in water. They live in extended family groups and younger family members help to raise their little brothers and sisters.", "moreAnimalInfo":"", "interestingFacts":"", "helpfulHints":"", "todaysFeed":"Come and see the otter talk and feed at our enclosure at 10.15am - Please check around the park as these times may change"}
  ]
  </code></pre>