VOOZH about

URL: https://www.geeksforgeeks.org/jquery/jquery-getjson-method/

โ‡ฑ jQuery getJSON() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

jQuery getJSON() Method

Last Updated : 11 Jul, 2025

In this article, we will learn about the getJSON() method in jQuery, along with understanding their implementation through the example. jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, It is widely famous for its philosophy of โ€œWrite less, do more"

The getJSON() method in jQuery fetches JSON-encoded data from the server using a GET HTTP request.

Syntax:

$(selector).getJSON(url,data,success(data,status,xhr))

Parameters: This method accepts three parameters as mentioned above and described below:

  • url: It is a required parameter. It is used to specify the URL in the form of a string to which the request is sent
  • data: It is an optional parameter that specifies data that will be sent to the server.
  • callback: It is also an optional parameter that runs when the request succeeds.

Return Value: It returns XMLHttpRequest object.

Please refer to the jQuery Tutorial and jQuery Examples articles for further details.

Example: The below example illustrates the getJSON() method in jQuery.

employee.json file:


"name": "Tony Stark", 
"age" : "53", 
"role": "Techincal content writer", 
"company":"Geeks for Geeks" 
}

Here, we get the JSON file and displays its content.

Output:

๐Ÿ‘ Image
 getJSON() Method
Comment
Article Tags:

Explore