This repository contains two Bash scripts designed to work with JSON files: json-merger.sh
for merging multiple JSON files into a single file, and json-linter.sh
for validating JSON files.
json-merger.sh
is a simple Bash script designed to merge multiple JSON files into a single JSON file containing a JSON array of the objects from the input files. This tool is especially useful when dealing with multiple configurations or data files in JSON format that need to be combined into a single file for processing or analysis.
- Combines multiple JSON files into a single JSON file.
- Ensures the output is a valid JSON file by wrapping the contents in a JSON array.
- Simple and easy to use, requiring only the Bash shell.
- Clone this repository or download the
json-merger.sh
file directly. - Make the script executable:
chmod +x json-merger.sh
. - Use the script by running:
./json-merger.sh jsonFile1.json jsonFile2.json [...jsonFileN.json]
.
json-linter.sh
is a Bash script for validating JSON files. It uses jq
to check if a given JSON file is valid. If the file is valid, the script outputs "Valid JSON"; otherwise, it prints "Invalid JSON".
jq
must be installed on your system to usejson-linter.sh
.
- Clone this repository or download the
json-linter.sh
file directly. - Make the script executable:
chmod +x json-linter.sh
. - Use the script by running:
./json-linter.sh jsonFile.json
.
Contributions are welcome! Please feel free to submit a pull request.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
This repository and its content were generated by ChatGPT. While efforts have been made to ensure the scripts function as expected, they come with no guarantees or warranties. Users should review and test the scripts before using them in production environments.