validate-json
A bash script that will allow you to validate a JSON string.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.3%) to scientific vocabulary
Keywords
Repository
A bash script that will allow you to validate a JSON string.
Basic Info
Statistics
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 3
- Releases: 1
Topics
Metadata Files
README.md
Overview
This is a very simple tool for validating a JSON string. It utilises jq for this purpose and wraps the output into something more consumable within other scripts.
Also see: json-lint for out travis plugin that performs a similar function.
Usage
There are 4 different options when it comes to using the validation tool.
- You can validate a raw json string
- You can validate the contents of a file
- You can just make use of error / return codes
- You can be given error messages as well as return codes
The first 2 options are handled by 2 different exposed functions.
Raw string
```shell source validate-json.sh
validate_json "
From file
```shell source validate-json.sh
validatejsonfrom_file "
This function will load the file contents into a string and then execute validate_json, so the final validation method is exactly the same to ensure identical results.
In additional to the two different wants to pass the data to the validator there are also 2 different ways to get data out of the validator.
Verbose Mode (default)
Verbose mode will display messages relating to the validity of the string, either everything was ok, or the specific error message returned by jq. It will also use return codes for success (0) and failure (1).
```shell source validate-json.sh
validatejsonfrom_file "
Silent Mode
This mode will suppress all output to the screen and will only use return codes.
```shell silence_messages=true
source validate-json.sh
validatejsonfrom_file "
This is particularly useful if you want to embed the validation into another script and take different actions depending on the result.
Embedding Silent Mode
```shell silence_messages=true
source validate-json.sh
if validatejsonfromfile "
Owner
- Name: Developers Toolbox
- Login: DevelopersToolbox
- Kind: organization
- Email: github@wolfsoftware.com
- Location: United Kingdom
- Website: https://wolfsoftware.com
- Twitter: wolfsoftware
- Repositories: 24
- Profile: https://github.com/DevelopersToolbox
A selection of tools to help developers. Created by Wolf Software.
Citation (CITATION.cff)
cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: JSON Validation
abstract: A bash script that will allow you to validate a JSON string.
type: software
version: 0.1.0
date-released: 2024-06-04
repository-code: https://github.com/DevelopersToolbox/validate-json
keywords:
- "Wolf Software"
- "Software"
license: MIT
authors:
- family-names: "Wolf"
orcid: "https://orcid.org/0009-0007-0983-2072"
GitHub Events
Total
- Delete event: 64
- Issue comment event: 132
- Push event: 120
- Pull request review event: 105
- Pull request event: 129
- Create event: 68
Last Year
- Delete event: 64
- Issue comment event: 132
- Push event: 120
- Pull request review event: 105
- Pull request event: 129
- Create event: 68
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 0
- Total pull requests: 82
- Average time to close issues: N/A
- Average time to close pull requests: 1 day
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.76
- Merged pull requests: 70
- Bot issues: 0
- Bot pull requests: 82
Past Year
- Issues: 0
- Pull requests: 65
- Average time to close issues: N/A
- Average time to close pull requests: 1 day
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.75
- Merged pull requests: 54
- Bot issues: 0
- Bot pull requests: 65
Top Authors
Issue Authors
- dependabot[bot] (1)
Pull Request Authors
- dependabot[bot] (129)