Skip to main content

JSONTas is a tool for generating dynamic JSON data.

Description

JSONTas adds conditionals and logic to JSON files in order to create dynamic JSON data depending on which dataset you supply.

It opens up the possibility to create generic tools where most of the operations are done by executing JSONTas on the data.

Documentation: https://jsontas.readthedocs.io/en/latest

Features

  • Simple yet powerful syntax.

  • HTTP requests on parse

  • Separation of environments by providing different datasets.

Installation

Install the project by running:

pip install jsontas

Examples

First we create two datasets. One for our ‘dev’ environment and one for our ‘prod’ environment.

Dataset ‘dev.json’

{
   "mode": "dev",
   "database": "dev_db"
}

Dataset ‘prod.json’

{
   "mode": "prod",
   "database": "prod_db"
}

JSONTas JSON file

Next up, let’s create our JSONTas file.

{
   "database": {
      "host": "myawesomedb.example.com",
      "database": "$database"
   },
   "message": {
      "$condition": {
         "if": {
            "key": "$mode",
            "operator": "$eq",
            "value": "dev"
         },
         "then": "This is the DEV server.",
         "else": "This is the PROD server."
      }
   }
}

JSONTas execute with ‘dev’ dataset

jsontas -d dev.json data.json
{
   "database": {
      "host": "myawesomedb.example.com",
      "database": "dev_db"
   },
   "message": "This is the DEV server."
}

JSONTas execute with ‘prod’ dataset

jsontas -d prod.json data.json
{
   "database": {
      "host": "myawesomedb.example.com",
      "database": "prod_db"
   },
   "message": "This is the PROD server."
}

These examples only show the bare minimum. For more examples look at our documentation at: https://jsontas.readthedocs.io/en/latest

Contribute

Support

If you are having issues, please let us know. Email tobias.persson@axis.com or just write an issue.

Metadata

Release files for jsontas 1.4.2

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

Source distribution (sdist)

Source distribution for jsontas 1.4.2
File Size Uploaded
jsontas-1.4.2.tar.gz 32.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jsontas 1.4.2
File Interpreter ABI Platform
jsontas-1.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 60.9 kB

Release files / jsontas-1.4.2.tar.gz

Download URL jsontas-1.4.2.tar.gz
Size 32.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b0ee006ef9a9ed310e93c29f3658cf975375e59c99ee587504033f32b660653b
BLAKE2b-256 checksum
How to use checksums
05ce7e595cea5e11550d90db0d7b29e29b247d9a39b16a4e93083dacb4a1e8a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / jsontas-1.4.2-py3-none-any.whl

Download URL jsontas-1.4.2-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76bb2ff3fda81ad5a6a3352189f9135283b73dbef2f71598ba3d0fe0749d8d41
BLAKE2b-256 checksum
How to use checksums
df71614413f3c32e640489652c897cc11cedd7cbefd1a2bf5d8af2e327049ff2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.4.2 This release

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

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