Downloaded JSON Code Suggestion

Hello people!

I’ve downloaded most of my algorithm solutions without checking the file extension and i now -at the end- realized that they are JSON files and are very hard to read.

I really dont want to manually make them readable so if anyone has any suggestions for automating this process to a readable text file, that would be amazing.

Thank you for reading this far :slight_smile:

JSON files are just formatted as JavaScript objects. You can pull information out of them using the same methods that you do for the JS exercises in FCC. The strings containing your solutions are formatted as strings, meaning that they contain escape characters. Just like when you learned escape sequences in FCC, if you print a formatted string either to the console or an output the escaped characters will be converted to the appropriate formatting.

Google “online json viewer” and you might find something helpful.

One way is to use an editor that can format the files for you. Notepad++ can do it using the JSON Viewer plugin:

This would be a good opportunity to learn how to

  • load a text file
  • parse it from JSON to an object
  • filter it for the information you want
  • format that information
  • write the formatted version to a new text file
1 Like

Thank you for the replies everyone! I’ll try all the suggestions!