This JSON Flattener transforms a potentially branched and deep JSON structure object into a flattened one.
- Python3
- Pytest
Open a terminal and Git clone
this repository to your machine
https://github.com/99rafa/JsonFlattener
Open a terminal in the JsonFlattener directory and run, for example
cat /path/to/jsonfile | python3 JsonFlattener.py
where /path/to/jsonfile
is the path of the .json file that contains the JSON object.
A prompt will appear
Check the file 'out.json' to get the flattened JSON version.
The out.json
file is where the flattened JSON object is stored.
To run the tests, run
pytest JsonFlattener.py
which will run the 3 unit tests produced, each one of them with one of the input files included in the example
folder.
Challenge Duration: 2 hours
Done by: Rafael Alexandre