{"id":19217,"date":"2023-08-23T05:10:17","date_gmt":"2023-08-23T03:10:17","guid":{"rendered":"https:\/\/raspberrytips.com\/?p=19217"},"modified":"2023-09-14T06:20:51","modified_gmt":"2023-09-14T04:20:51","slug":"edit-json-files-linux-terminal","status":"publish","type":"post","link":"https:\/\/raspberrytips.com\/edit-json-files-linux-terminal\/","title":{"rendered":"How To Create and Edit JSON Files In Linux Terminal"},"content":{"rendered":"\n

JSON files are widely used by developers to save configurations and share data across servers and applications. They’re built to be easy for both machines and people to understand. But if you only have a Linux terminal to work with, it’s not that easy. Let me give you a few tips to improve that.<\/p>\n\n\n\n

As a whole, JSON files are basically text files formatted in a specific way. Any text editor can create and edit them without any add-on required. But tools like “jq” can be used to make them more readable.<\/strong><\/p>\n\n\n\n

I know that there is no perfect solution to edit JSON files like in a desktop environment, but stay with me as I have some good tips to share with you.<\/p>\n\n\n\n

Creating a JSON File in Linux Terminal<\/h2>\n\n\n\n

Basically, JSON files are simply text files formatted in a very specific way. While the formatting is strict, the content itself is just text, so you can use any text editor you like for this task.<\/p>\n\n\n\n

As JSON files are purely text files ending with a “.json” extension, you can simply create an empty JSON file with the Linux terminal by using the “touch” command:
<\/strong>touch myfile.json<\/code><\/p>\n\n\n\n

The “touch” command on Linux is widely used to create empty text files. But if your goal is to write the JSON file content, then it’s better to use a full editor. The two most popular are:<\/p>\n\n\n\n