Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
How do I save external JSON data to a JavaScript variable?

I have an JSON file (I cannot change), data.json that looks like:

{
    "Data": [
        {
            "AccountId": "1234",
            "ClientId": "12345567",
            "Amount": 140.68,
            "BalanceYear": "2015",
            "AccountName": "Master"
        },
    "Success": true,
    "Errors": null
}

I am bringing it into my .js file as such:

 <script type="text/javascript" src="./data.json"></script>

And I want to iterate through it with JSON.parse.

My only issue is getting the data from the .json file to the JSON.parse function.

var mydata = JSON.parse(???);

Would anyone know how I can do this?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!