Interactively exploring a large JSON file with fx

Andrew Smith
InstructorAndrew Smith
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

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.

egghead
egghead
~ 15 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today