

How to format large JSON file in command line
source link: https://serebrov.github.io/html/2023-06-11-format-json-command-line.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

How to format large JSON file in command line
There are several tools that can be used to format the large json file.
Prettier (if you have node.js and npx installed):
npx run prettier input_json.json > formatted_json.json
With python:
cat input_json.json | python -m json.tool > formatted_json.json
# json.tool uses 4 spaces as indent by default, we can change it:
cat input_json.json | python -m json.tool --indent 2 > formatted_json.json
With jq:
jq '.' input_json.json > formatted_json.json
Reminder: to open a large file in vim / nvim it is better to run it with -u NONE
: nvim -u NONE formatted_json.json
.
Recommend
-
10
-
3
How to Choose a Company for Large Format Printing in London If you own a business, you want to ensure that it gains maximum exposure. This is true whe...
-
5
Read Excel File in JSON Format Using Nodejs This tutorial help to read excel file using nodejs. We’ll let you know to read the excel file in JSON format and insert it into MySQL data or NoSQL database using rest API.
-
7
Show HN: Jless, a command-line JSON viewer Show HN: Jless, a command-line JSON viewer (
-
7
How to format SQL using the command line Last modified: Imagine having a tool that can automatically detect JPA and Hibernate performance issues. Wouldn't that be ju...
-
10
Introduction Write a Python program to convert PO files to J...
-
11
Sample PO files In this example, we support two locale, zh_TW (Traditional Chinese) and
-
10
This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc. Convert .mov/.MP4 to .gif Reason As a developer, I feel better to upload a short video when I create the pull...
-
3
Lighter
-
12
josn-cli is a command-line JSON viewer, written in JavaScript and TypeScript. I felt the need for a JSON browser when I...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK