Skip to main content

JSON Simple Validator

About

This is a simple JSON validator built for and tested using Flask applications.

Usage

To install the validator:

pip install json-simple-validator

Sample usage of the validator:

from json_simple_validator import field_validation


## Example Flask request
@app.route("/post", methods = ["POST"])
def post():
	validation_list = [
		{"field": "name"},
        {"field": "pass", "alias": "Password"},
        {"field": "number", "var_type": [int]}
	]

# 	validation_list = [
# 		# Each element is made up of the field that is being validated
# 		# and the alias of the field that is to be displayed, should there be an error

# 		# Sample dict:
# 		# {"name": "", e.g "first_name"
# 		# "alias[optional]": "", eg "First Name" If left out, title case of field name is used
# 		# "var_type[optional]": "", eg [str, bool, int]
# 		# "length[optional]": "[min, max(optional)]", eg [2, 10]
# 		# "special_rules": ""} eg ["email"] Only email is supported for now

	messages = fieldValidation(request.json, validation_list)

	if messages:
		return jsonify({"messages": messages}), 422

Post the following to the above endpoint:

{
	"name": "",
	"pass": "",
	"number": "121231"
}

The following is returned:

{
	"messages": [
        "Name is empty.",
        "Password is empty.",
        "Number data type is not of the expected data type."
    ]
}

Metadata

Release files for json-simple-validator 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-simple-validator 1.0.1
File Size Uploaded Provenance Actions
json-simple-validator-1.0.1.tar.gz 3.8 kB Without provenance Details for json-simple-validator-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for json-simple-validator 1.0.1
File Interpreter ABI Platform Actions
json_simple_validator-1.0.1-py3-none-any.whl Python 3 none any Details for json_simple_validator-1.0.1-py3-none-any.whl

Total release size: 9.0 kB

Release files / json-simple-validator-1.0.1.tar.gz

Download URL json-simple-validator-1.0.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cfe9763aa66f7bb3c5542c6d8b009e4f47c73ad5c8a00976a3ef70a190adf9de
BLAKE2b-256 checksum
How to use checksums
3e995b406bdee67ea7e09816c4144e94ea7cd7eebf0d4e3e8e0459913811090b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.2

Release files / json_simple_validator-1.0.1-py3-none-any.whl

Download URL json_simple_validator-1.0.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00d79c02e8fde04be64f71bcc4f9fb0a82b4b882ffd9f343eafff5cafed066bf
BLAKE2b-256 checksum
How to use checksums
be31d48101e7357edeca4f832a862c2df24e8522d608965be2aa299ceaef15bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.5.1 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.2

Security for json-simple-validator 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page