ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.tutorialrepublic.com/faq/how-to-load-local-json-file-using-jquery.php |
| Last Crawled | 2026-04-16 15:32:23 (23 hours ago) |
| First Indexed | 2020-04-29 19:59:30 (5 years ago) |
| HTTP Status Code | 200 |
| Meta Title | How to Load Local JSON File Using jQuery |
| Meta Description | null |
| Meta Canonical | null |
| Boilerpipe Text | Advertisements
Topic:
JavaScript / jQuery
Prev
|
Next
Answer: 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">
<head>
<meta charset="utf-8">
<title>jQuery Loading Local JSON File</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
$.getJSON("test.json", function(data){
console.log(data.name); // Prints: Harry
console.log(data.age); // Prints: 14
}).fail(function(){
console.log("An error has occurred.");
});
});
</script>
</body>
</html>
The "test.json" file contains a simple JSON string
{"name": "Harry", "age": 14}
.
Related FAQ
Here are some more FAQ related to this topic:
How to parse JSON in JavaScript
How to convert JavaScript object to JSON string
How to check if an object property is undefined in JavaScript
Advertisements |
| Markdown | [](https://www.tutorialrepublic.com/)
[HOME](https://www.tutorialrepublic.com/ "Home Page") [HTML5](https://www.tutorialrepublic.com/html-tutorial/ "HTML Tutorial") [CSS3](https://www.tutorialrepublic.com/css-tutorial/ "CSS Tutorial") [JAVASCRIPT](https://www.tutorialrepublic.com/javascript-tutorial/ "JavaScript Tutorial") [JQUERY](https://www.tutorialrepublic.com/jquery-tutorial/ "jQuery Tutorial") [BOOTSTRAP5](https://www.tutorialrepublic.com/twitter-bootstrap-tutorial/ "Bootstrap 5 Tutorial") [v4.6](https://www.tutorialrepublic.com/twitter-bootstrap-4-tutorial/ "Bootstrap 4.6 Tutorial") [PHP7](https://www.tutorialrepublic.com/php-tutorial/ "PHP Tutorial") [SQL](https://www.tutorialrepublic.com/sql-tutorial/ "SQL Tutorial") [REFERENCES](https://www.tutorialrepublic.com/references.php "Web References") [EXAMPLES](https://www.tutorialrepublic.com/practice-examples.php "Practice Examples and Demos") [FAQ](https://www.tutorialrepublic.com/faq.php "Frequently Asked Questions and Answers") [SNIPPETS](https://www.tutorialrepublic.com/snippets/gallery.php "Bootstrap Code Snippets") [Online HTML Editor](https://www.tutorialrepublic.com/codelab.php)
WEB TUTORIALS
[HTML Tutorial](https://www.tutorialrepublic.com/html-tutorial/) [CSS Tutorial](https://www.tutorialrepublic.com/css-tutorial/) [JavaScript Tutorial](https://www.tutorialrepublic.com/javascript-tutorial/) [jQuery Tutorial](https://www.tutorialrepublic.com/jquery-tutorial/) [Bootstrap Tutorial](https://www.tutorialrepublic.com/twitter-bootstrap-tutorial/) [PHP Tutorial](https://www.tutorialrepublic.com/php-tutorial/) [SQL Tutorial](https://www.tutorialrepublic.com/sql-tutorial/)
PRACTICE EXAMPLES
[HTML Examples](https://www.tutorialrepublic.com/html-examples.php) [CSS Examples](https://www.tutorialrepublic.com/css-examples.php) [JavaScript Examples](https://www.tutorialrepublic.com/javascript-examples.php) [jQuery Examples](https://www.tutorialrepublic.com/jquery-examples.php) [Bootstrap Examples](https://www.tutorialrepublic.com/twitter-bootstrap-examples.php) [PHP Examples](https://www.tutorialrepublic.com/php-examples.php)
HTML REFERENCES
[HTML Tags/Elements](https://www.tutorialrepublic.com/html-reference/html5-tags.php) [HTML Global Attributes](https://www.tutorialrepublic.com/html-reference/html5-global-attributes.php) [HTML Event Attributes](https://www.tutorialrepublic.com/html-reference/html5-event-attributes.php) [HTML Color Picker](https://www.tutorialrepublic.com/html-reference/html-color-picker.php) [HTML Language Codes](https://www.tutorialrepublic.com/html-reference/html-language-codes.php) [HTML Character Entities](https://www.tutorialrepublic.com/html-reference/html-character-entities.php) [HTTP Status Codes](https://www.tutorialrepublic.com/html-reference/http-status-codes.php)
CSS REFERENCES
[CSS At-rules](https://www.tutorialrepublic.com/css-reference/css-at-rules.php) [CSS Properties](https://www.tutorialrepublic.com/css-reference/css3-properties.php) [CSS Animatable Properties](https://www.tutorialrepublic.com/css-reference/css-animatable-properties.php) [CSS Color Values](https://www.tutorialrepublic.com/css-reference/css-color-values.php) [CSS Color Names](https://www.tutorialrepublic.com/css-reference/css-color-names.php) [CSS Web Safe Fonts](https://www.tutorialrepublic.com/css-reference/css-web-safe-fonts.php) [CSS Aural Properties](https://www.tutorialrepublic.com/css-reference/css-aural-properties.php)
PHP REFERENCES
[PHP Array Functions](https://www.tutorialrepublic.com/php-reference/php-array-functions.php) [PHP String Functions](https://www.tutorialrepublic.com/php-reference/php-string-functions.php) [PHP File System Functions](https://www.tutorialrepublic.com/php-reference/php-file-system-functions.php) [PHP Date/Time Functions](https://www.tutorialrepublic.com/php-reference/php-date-and-time-functions.php) [PHP Calendar Functions](https://www.tutorialrepublic.com/php-reference/php-calendar-functions.php) [PHP MySQLi Functions](https://www.tutorialrepublic.com/php-reference/php-mysqli-functions.php) [PHP Filters](https://www.tutorialrepublic.com/php-reference/php-filters.php) [PHP Error Levels](https://www.tutorialrepublic.com/php-reference/php-error-levels.php)
Advertisements
# How to Load Local JSON File Using jQuery
Topic: [JavaScript / jQuery](https://www.tutorialrepublic.com/faq.php#javascript-jquery)[Prev](https://www.tutorialrepublic.com/faq/how-to-convert-utc-date-time-to-local-date-time-in-javascript.php)\|[Next](https://www.tutorialrepublic.com/faq/how-to-trigger-a-click-on-a-link-using-jquery.php)
## Answer: 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:
#### Example
[Try this code »](https://www.tutorialrepublic.com/codelab.php?topic=faq&file=jquery-load-local-json-file "Try this code using online Editor")
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Loading Local JSON File</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
$.getJSON("test.json", function(data){
console.log(data.name); // Prints: Harry
console.log(data.age); // Prints: 14
}).fail(function(){
console.log("An error has occurred.");
});
});
</script>
</body>
</html>
```
The "test.json" file contains a simple JSON string `{"name": "Harry", "age": 14}`.
***
## Related FAQ
Here are some more FAQ related to this topic:
- [How to parse JSON in JavaScript](https://www.tutorialrepublic.com/faq/how-to-parse-json-in-javascript.php)
- [How to convert JavaScript object to JSON string](https://www.tutorialrepublic.com/faq/how-to-convert-js-object-to-json-string.php)
- [How to check if an object property is undefined in JavaScript](https://www.tutorialrepublic.com/faq/how-to-check-if-an-object-property-is-undefined-in-javascript.php)
[Previous Page](https://www.tutorialrepublic.com/faq/how-to-convert-utc-date-time-to-local-date-time-in-javascript.php) [Next Page](https://www.tutorialrepublic.com/faq/how-to-trigger-a-click-on-a-link-using-jquery.php)
Advertisements
[](https://www.tutorialrepublic.com/snippets/gallery.php) [](https://www.propertymarvels.com/)
Advertisements
Is this website helpful to you? Please give us a [like](https://www.tutorialrepublic.com/like.php), or share your [feedback](https://www.tutorialrepublic.com/contact-us.php) *to help us improve*. Connect with us on [Facebook](https://www.facebook.com/tutorialrepublic) and [Twitter](https://twitter.com/tutrepublic) for the latest updates.
#### About Us
[Our Story](https://www.tutorialrepublic.com/about-us.php) [Terms of Use](https://www.tutorialrepublic.com/terms-of-use.php) [Privacy Policy](https://www.tutorialrepublic.com/privacy-policy.php)
#### Contact
[Contact Us](https://www.tutorialrepublic.com/contact-us.php) [Report Error](https://www.tutorialrepublic.com/contact-us.php) [Advertise](https://www.tutorialrepublic.com/advertise-with-us.php)
#### Interactive Tools
[Bootstrap Icon Search Utility](https://www.tutorialrepublic.com/bootstrap-icons-classes.php) [HTML Formatter](https://www.tutorialrepublic.com/html-formatter.php) [Title & Meta Length Calculator](https://www.tutorialrepublic.com/faq/what-is-the-maximum-length-of-title-and-meta-description-tag.php) [HTML Color Picker](https://www.tutorialrepublic.com/html-reference/html-color-picker.php) [Bootstrap Button Generator](https://www.tutorialrepublic.com/twitter-bootstrap-button-generator.php) [SQL Playground](https://www.tutorialrepublic.com/codelab.php?topic=sql&file=select-all) [Font Awesome Icon Finder](https://www.tutorialrepublic.com/font-awesome-icons-classes.php) [HTML Editor](https://www.tutorialrepublic.com/codelab.php?topic=html&file=hello-world)

[](https://www.buymeacoffee.com/tutrepublic)
Copyright © 2026 Tutorial Republic. All Rights Reserved.
*Share This:* |
| Readable Markdown | Advertisements
Topic: [JavaScript / jQuery](https://www.tutorialrepublic.com/faq.php#javascript-jquery)[Prev](https://www.tutorialrepublic.com/faq/how-to-convert-utc-date-time-to-local-date-time-in-javascript.php)\|[Next](https://www.tutorialrepublic.com/faq/how-to-trigger-a-click-on-a-link-using-jquery.php)
## Answer: 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">
<head>
<meta charset="utf-8">
<title>jQuery Loading Local JSON File</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
$.getJSON("test.json", function(data){
console.log(data.name); // Prints: Harry
console.log(data.age); // Prints: 14
}).fail(function(){
console.log("An error has occurred.");
});
});
</script>
</body>
</html>
```
The "test.json" file contains a simple JSON string `{"name": "Harry", "age": 14}`.
***
## Related FAQ
Here are some more FAQ related to this topic:
- [How to parse JSON in JavaScript](https://www.tutorialrepublic.com/faq/how-to-parse-json-in-javascript.php)
- [How to convert JavaScript object to JSON string](https://www.tutorialrepublic.com/faq/how-to-convert-js-object-to-json-string.php)
- [How to check if an object property is undefined in JavaScript](https://www.tutorialrepublic.com/faq/how-to-check-if-an-object-property-is-undefined-in-javascript.php)
Advertisements |
| Shard | 147 (laksa) |
| Root Hash | 13123960086470146547 |
| Unparsed URL | com,tutorialrepublic!www,/faq/how-to-load-local-json-file-using-jquery.php s443 |