Folder: csc336-fall2025/07-json-world/
In this assignment, you’ll design a small imaginary world in JSON, then write a simple Node.js script that reads and processes it.
fs moduleCreate a file called world.json that describes a small imaginary world using nested JSON. If you are having trouble with understanding JSON, see this: JSON Introduction (W3Schools)
"regions" whose value is an array."name" – the name of the region"climate" – a string (e.g. "temperate", "arid")"towns" – an array of town objects"name" – the town’s name"population" – a number"notable_people" – an array of people"name" – their full name"role" – their occupation or title"items" – an array of objects or strings representing their possessions"name" and "rarity").Before submitting, check that your JSON file is valid:
Paste your JSON there and ensure you see “Valid JSON”.
In the same folder, create a file called world.js that:
fs module using an ES module import (not require()).world.json file from disk."notable_people" names, all town names, or all items with a particular property.import syntax in Node, you must create a file called package.json in the same folder and include this line inside it:
{
"type": "module"
}
Then, your import at the top of world.js should look like this:
import * as fs from 'fs'; // or import fs from 'fs';
Run your program in the terminal with:
node world.js
Submit the following files:
world.jsonworld.jspackage.jsonEach file should be neatly formatted and easy to read.