Skip to main content

A simple CLI tool to validate JSON files

Project description

JSON Validator CLI

A simple, lightweight command-line tool to validate JSON files and check them against JSON schemas.

Features

  • ✅ Validate JSON file syntax
  • ✅ Validate JSON against JSON Schema
  • ✅ Pretty-print JSON files
  • ✅ Clear error messages
  • ✅ Easy to use CLI interface

Installation

Install from PyPI (when published)

pip install jsonvalidator-cli

Install from source

git clone https://github.com/bijesh-bits/jsonvalidator.git
cd jsonvalidator
pip install -e .

For development

git clone https://github.com/bijesh-bits/jsonvalidator.git
cd jsonvalidator
pip install -e ".[dev]"

Requirements

  • Python 3.8 or higher
  • jsonschema library (automatically installed)

Usage

Validate JSON syntax

jsonvalidator validate data.json

Example output:

✓ 'data.json' is valid JSON

Validate against a JSON Schema

jsonvalidator validate data.json --schema schema.json

Example output:

✓ 'data.json' is valid according to schema 'schema.json'

Pretty-print JSON

jsonvalidator format data.json

You can customize indentation:

jsonvalidator format data.json --indent 4

Show version

jsonvalidator version

Examples

Create a sample JSON file:

{
  "name": "John Doe",
  "age": 30,
  "email": "john@example.com"
}

Create a schema file:

{
  "type": "object",
  "properties": {
    "name": {"type": "string"},
    "age": {"type": "integer"},
    "email": {"type": "string", "format": "email"}
  },
  "required": ["name", "email"]
}

Then validate:

jsonvalidator validate user.json --schema user-schema.json

Use Cases

  • Quick JSON validation during development
  • CI/CD pipelines - validate configuration files
  • Data validation - ensure JSON data meets requirements
  • Learning tool - understand JSON Schema validation

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Changelog

See CHANGELOG.md for version history and changes.

Authors

Created by Code-Crafters as part of an Open Source Software course project at BITS Pilani.

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonvalidator_cli-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonvalidator_cli-0.1.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file jsonvalidator_cli-0.1.0.tar.gz.

File metadata

  • Download URL: jsonvalidator_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for jsonvalidator_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6f50e056c166174c42fc2d091c15053cb6b777d2a5d62aebe35d324e8ed66b63
MD5 3a05bda496a115be7e7af9a8c9f6eeb7
BLAKE2b-256 9b030d53fa3fc376392a40cf62ae16db63986e5354b9287b8e19e60395332233

See more details on using hashes here.

File details

Details for the file jsonvalidator_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jsonvalidator_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80bd5dad3b6f52b887b1f747725bf04bbbddddeac9e55bbc26d7a9cee70df7f6
MD5 c1b6f4e433b4d2a2699184d447516d71
BLAKE2b-256 99156d1b87421e8110047ff0c39dedc846f2f1a810a5bd7b75a08ebb038e55ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page