title: How to display .json file on webpage when it's in a <script> tag?
body: <p>Is there a way to manipulate and display the data in the file without using fetch? In addition, can I store the json file in a variable and iterate through it? It just seems that for a local file there would be a simpler method of working with/displaying the data...</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; href =&quot;styles.css&quot;&gt;
      &lt;script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js”&gt;&lt;/script&gt;
      &lt;script src=&quot;main.js&quot;&gt;&lt;/script&gt;
      &lt;script src=&quot;animals.json&quot;&gt;&lt;/script&gt; &lt;!-- added json file--&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div class =&quot;sampleDiv&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
      
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>json file</p>
  <pre><code>[
      {
        &quot;name&quot;: &quot;Whiskers&quot;,
        &quot;species&quot; : &quot;cat&quot;,
        &quot;foods&quot;: {
          &quot;likes&quot;: [&quot;celery&quot;, &quot;strawberries&quot;],
          &quot;dislikes&quot;: [&quot;carrots&quot;]
        }
      },
      {
        &quot;name&quot;: &quot;Woof&quot;,
        &quot;species&quot; : &quot;dog&quot;,
        &quot;foods&quot;: {
          &quot;likes&quot;: [&quot;dog food&quot;],
          &quot;dislikes&quot;: [&quot;cat food&quot;]
        }
      },
      {
        &quot;name&quot;: &quot;Fluffy&quot;,
        &quot;species&quot; : &quot;cat&quot;,
        &quot;foods&quot;: {
          &quot;likes&quot;: [&quot;canned food&quot;],
          &quot;dislikes&quot;: [&quot;dry food&quot;]
        }
      }
    ]
  </code></pre>