How to Load Local JSON File Using jQuery

  9061 views   2 years ago jQuery

Use the jQuery $.getJSON() Method

You can simply use the $.getJSON() method to load local JSON file from the server using a GET HTTP request. If the JSON file contains a syntax error, the request will usually fail silently.

Let's try out the following example to understand how it basically works:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery Loading Local JSON File</title>
<script src=""></script>
        $.getJSON("test.json", function(data){
            console.log(; // Prints: Harry
            console.log(data.age); // Prints: 14
            console.log("An error has occurred.");


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]