Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
AJAX API JSON Connect to JSON data using AJAX webpage
Rating: 4.3 out of 5(59 ratings)
4,794 students

AJAX API JSON Connect to JSON data using AJAX webpage

JavaScript for beginners JavaScript Objects and JSON data for web pages AJAX request for JSON data to use in JavaScript
Created byLaurence Svekis
Last updated 11/2024
English
English [Auto],

What you'll learn

  • How to use JavaScript Objects
  • How to use JSON data
  • Explore JavaScript

Course content

2 sections39 lectures1h 37m total length
  • API JSON Introduction2:28

    Connect to JSON data and web API endpoints with Ajax and JavaScript, fetch and post JSON using get and post methods, and render JSON objects and arrays on pages.

  • Introduction to JSON3:34

    Learn JSON basics and how it mirrors JavaScript objects and arrays for cross-language data transmission. Set up a basic page, link a script, and practice extracting values from JSON responses.

  • JavaScript Objects5:31

    Discover how JavaScript objects organize data and how JSON differs, using a friend object with nested name and location. Learn dot and bracket notation to access and output values.

  • Source Code0:06
  • JavaScript Arrays2:27

    Explore how json data uses arrays of objects to store items, access by index, and output properties like name, highlighting the importance of structure for iterating json data.

  • Source Code0:09
  • Output Contents3:14

    Traverse layered JSON data, loop through a friends array, and output each item with template literals and inner HTML, then parse JSON and convert objects to strings.

  • Source Code0:14
  • JSON Stringify JSON Parse3:01

    Learn how to convert JSON strings to JavaScript objects using JSON.parse, JSON.stringify, and access data within arrays and properties from a JSON API response.

  • Source Code0:14
  • Updates0:05
  • Validate lint JSON3:05

    Learn to validate and structure JSON with proper double quotes, use a validator to spot errors, and fetch JSON data with Ajax on a webpage.

  • Sample JSON source0:10
  • JavaScript Fetch AJAX request4:05

    Learn to fetch json data with a JavaScript fetch AJAX request by wiring a URL, handling the response, parsing JSON, and rendering friend data in HTML.

  • Source Code0:04
  • Fetch Web APIs AJAX from web pages2:36

    Connect to the GitHub web API to fetch repository data on a webpage in paginated chunks of 30. Display item IDs, explore descriptions, and prepare to refactor with arrow functions.

  • Source Code GitHub0:04
  • JavaScript Arrow Function format1:55

    Modernize the code by replacing function keywords with arrow functions, simplify the for-each usage, return content as JSON, and add catch blocks to fetch errors with console logging.

  • Source Code0:04
  • Fetch Options GET3:04

    Send requests with fetch options object to specify get or post methods, inspect API responses, and display wiki media data on a web page.

  • SOURCE CODE0:05
  • CORS with request debugging2:29

    Explain how cross origin sharing errors block requests and how servers control access by origin. Demonstrate using a cors anywhere service on herokuapp.com to access API data locally.

  • Source Code0:04
  • More Open APIs Practice3:23

    Connect to open APIs using ajax to fetch random and searched jokes, display results on a web page, and loop through data from the API.

  • Source Code0:05
  • Fun with APIs Tools and More4:35

    Explore using ajax to fetch JSON data from APIs, render user data and avatars on a page, and practice get, post, put, patch, and delete with Post Woman.

  • source code0:11
  • API Next Page Load all pages5:31

    Select an API with paged results and load all pages using a fetch request. Iterate through the JSON data and recursively fetch the next page until next is null.

  • Source Code0:09
  • Post method send data3:26

    Post data to an API endpoint using a form data object, appending content and sending an array via fetch with post and JSON stringify to receive a JSON response.

  • Source Code0:15
  • Practice API endpoints4:49

    Practice api endpoints by using ajax and fetch to retrieve the joke of the day from the animal category and display it on your web page.

  • Source Code0:05
  • More API endpoints AJAX request Exercise and JSON data4:13

    Practice connecting to API endpoints using AJAX to fetch JSON data, exploring the stock exchange API, its docs, and returning posts and users to a web application.

  • Source Code0:05
  • API JSON conclusion3:20

    Learn how to connect to API endpoints using fetch, retrieve JSON, validate output in the console, and display the desired data in the web page via the DOM.

Requirements

  • JavaScript
  • Programming and coding knowledge
  • HTML and some programming experience

Description

Explore how you can connect to various endpoints on the web and get JSON data to use on your website. 

JSON data and JavaScript Objects


JavaScript Object Notation (JSON) is an open-standard file format or data interchange format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types. It is a very common data format, with a diverse range of applications.

JSON is a language-independent data format. It was derived from JavaScript, but many modern programming languages include code to generate and parse JSON-format data. The official Internet media type for JSON is application/json. JSON filenames use the extension .json.

AJAX ("Asynchronous JavaScript + XML") is a set of web development techniques using many web technologies on the client side to create asynchronous web applications. With Ajax, web applications can send and retrieve data from a server asynchronously (in the background) without interfering with the display and behavior of the existing page. By decoupling the data interchange layer from the presentation layer, Ajax allows web pages and, by extension, web applications, to change content dynamically without the need to reload the entire page.

In practice, modern implementations commonly utilize JSON instead of XML.

Course Covers

  • JavaScript Objects and how they are used in code to retrieve values and store groups of related data sets

  • JavaScript Arrays - a data structure commonly used in JSON to contain Objects

  • JSON vs JavaSCript Objects

  • Iterate Array Contents

  • JSON parse and Stringify

  • Tools online to help connect to endpoints and debug AJAX requests

  • Use of JavaScript Fetch to return content

  • GET and POST methods to web endpoints

  • Various examples of open web APIs

Source Code is included.

JavaScript Object

An object is a collection of related data and/or functionality.

  • Functions can be contained in JavaScript objects they are referred to as methods within the object.

  • JavaScript objects names don’t need quotes, can be single, double or none.

  • Values can be Strings, Numbers, Booleans, Arrays, Objects

Create an object setting a variable name and assigning the {} to the variable.

Object names can hold values of other objects and arrays

Can go multiple levels deep, as many as needed.

Dot notation : The object name (person) acts as the namespace, then a dot, then the item you want to access.

Bracket notation : Similar format to arrays, instead of using an index number to select an item you are using the name associated with each member's value.

JavaScript Array

An Array can hold multiple values

Arrays cannot use strings as element indexes but must use integers.

Arrays are zero based, first index value is always 0;

Array values can be strings, numbers, booleans, arrays or objects.

The design of objects and arrays is to hold lots of content. You can loop through the content in a number of ways using JavaScript.

You can loop through the data in the array using a number of methods in JavaScript. Arrays need the index to find the value associated with it. If objects are contained within you should structure them the same way so it is easier to check the values contained.

Objects have length so using a for loop is possible. There is also Object.entries which can get the key and the value from the object.

Keep data structured the same so that you can easily determine where the values are located.

The JSON.stringify() method converts a JavaScript object or value to a JSON string

The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string

The JSON object contains methods for parsing JavaScript Object Notation (JSON) and converting values to JSON.

  • Objects and Arrays: Property names must be double-quoted strings; trailing commas are forbidden.

  • Numbers: Leading zeros are prohibited; a decimal point must be followed by at least one digit. NaN and Infinity are unsupported.

Please note that the scope of this course using JavaScript and JSON data outputting via JavaScript.  If you are looking for a more detailed JavaScript course this course is not for you.  Simple course with limited scope designed to be topic specific.

Taught by an instructor with over 20 years of Web Development experience.

If you've been looking to get started with AJAX and JSON-  THIS COURSE IS FOR YOU!!!!

Nothing to lose - Fast friendly support is always available to help if you need it.

Please note that the SCOPE OF THIS COURSE IS Creating a simple API and JSON and will not cover complex commands and everything about JavaScript, HOW TO GET STARTED COURSE - if you are looking at more detailed node or JavaScript content this is not for you.

Who this course is for:

  • Web designers
  • Web Developers
  • Anyone who is building a website
  • Webmasters and web coders creating web content