MongoDB Coding Challenge

Task

Writing a program that takes a JSON object as input and outputs a flattened version of the JSON object, with keys as the path to every terminal value in the JSON structure. Output should be valid JSON.

Requirements

In order to run the project, make sure you have Node.js installed

How to install

  1. Clone the repository
  2. Go to the project directory

How to run

The program is expecting a json or text file. Replace '<your file path>' with the path to the file to flatten.

cat <your file path> | node challenge.js

The flattened JSON will be available in the created 'output.json' file in the project directory

Running the script with the tests

To run the script containing some test files, run the following command in the project directory:

sh script.sh