mongoDBOAflattenJSON

Introduction

This is my submission for the MongoDB OA in Javascript. I spent a little under an hour on this in total.

How to use

You can call my code with

cat example.json | node mongoDBOA.js

after cloning/downloading my code. example.JSON can be any json file. I have added some sample JSON-files for testing purposes. I used code for reading JSON files from stdin from this github gist: https://gist.github.com/kristopherjohnson/5065599 but my solution at the bottom of the file is of course my own work!

This requires node, and I am using Node v14.15.5. You can read the output in the terminal.

I hope you like it!