JSON Parsing Lab

Easy
6
55.2% Acceptance

Revised Instructions

In this exercise lab, the primary focus is to enhance your skills associated with various JSON operations. You will delve into manipulating JSON strings, accessing and modifying their properties, and concluding with exporting the revised JSON object.

To accomplish these tasks, the JSON.parse() function has to be employed to structure the received JSON string and store it in a suitable variable. This will facilitate easy access to JSON object properties. You are then expected to update these property values to new ones as required and complete the operation by exporting the newly modified JSON object using the 'export' keyword.

For a better understanding of these operations, you will work interactively with the data.json file provided. This real-time experience will ensure you grasp the core concepts effectively while enjoying the hands-on challenges.

Instructions

  1. Import the data.json file using the readFileSync() method from the fs (File System) module of Node.js
  2. Parse the Json Object from the file string that is outputted by the readFileSync() method
  3. Update the age property of the JSON Object
  4. Export the JSON Object using the export default keywords. This ensures that any other js file can direcltly import the data using their own name, instead of using a named exports.