Interactively exploring a large JSON file with fx

Andrew Smith
InstructorAndrew Smith
Share this video with your friends

Social Share Links

Send Tweet

Opening large JSON files inside of your IDE or text editor can be a pain at times, with this command line tool you can drill down into large JSON files with just a few commands.

We will explore opening a large JSON file containing an array of more than 5000 items, while being able to filter down into an item and to a given property with the help of autocompletion from the fx command line tool.

Instructor: [0:00] You can install fx globally from npm using npm install -g fx, or you can install it locally using npm install fx. You can read large files in interactive mode using the fx command followed by the JSON file name.

[0:18] Let's expand the first node by clicking on it. Then, let's go further to the users node. Now you can close these nodes by clicking on them, or you can use the left and right arrow keys on your keyboard to navigate the nodes.

[0:31] You can filter in interactive mode by pressing the period key on your keyboard. You can dive into an object using this arrayValue followed by a dot. Now, you get an autocomplete telling you which properties you can filter by. Let's filter by the user.name. We can clear the filter by pressing Ctrl-U on your keyboard. You can check the size of an array using .length.

[0:58] Let's exit interactive mode by pressing Ctrl-U, Enter, Ctrl-C.