Downloaded JSON Code Suggestion

Downloaded JSON Code Suggestion
0

#1

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:


#2

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.


#3

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


#4

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


#5

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

#6

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