Welcome to Lesson 5 of Communicating with APIs for Front-End Engineers. Today's focus is on handling data fetched from APIs, transforming JSON data into JavaScript objects, and manipulating data using the filter
, map
, and reduce
methods. We'll also discuss how to handle errors that may occur during the transformation process.
Data transformation refers to the process of converting data from one format or structure into another. When handling APIs, we're dealing primarily with data fetched in the JSON (JavaScript Object Notation) format, a lightweight, human-readable data interchange format. For efficient processing, we convert the JSON data into JavaScript objects.
The JSON.parse()
method allows us to convert JSON data into JavaScript objects:
In this example, obj
is a JavaScript object that contains the properties name
and age
derived from the JSON string.
