Skip to main content

JSONTas is a tool for generating dynamic JSON structures.

Project description

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.

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

jsontas-1.4.2.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

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

jsontas-1.4.2-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file jsontas-1.4.2.tar.gz.

File metadata

  • Download URL: jsontas-1.4.2.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for jsontas-1.4.2.tar.gz
Algorithm Hash digest
SHA256 b0ee006ef9a9ed310e93c29f3658cf975375e59c99ee587504033f32b660653b
MD5 2e85cfae96c712dff645d050d720888d
BLAKE2b-256 05ce7e595cea5e11550d90db0d7b29e29b247d9a39b16a4e93083dacb4a1e8a2

See more details on using hashes here.

File details

Details for the file jsontas-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: jsontas-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for jsontas-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 76bb2ff3fda81ad5a6a3352189f9135283b73dbef2f71598ba3d0fe0749d8d41
MD5 923cfd4108531ed6e519b8947bce7164
BLAKE2b-256 df71614413f3c32e640489652c897cc11cedd7cbefd1a2bf5d8af2e327049ff2

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