Skip to main content

sceptre-json-resolver

A Sceptre resolver to serialize and deserialize json.

Motivation

There are use cases where you may want to pass in either a string or a json object to a cloudformation or sceptre_user_data parameter. This simple resolver can take some json and serialize it or deserialize it before passing it into a cloudformation parameter or a scepter_user_data parameter.

Installation

To install directly from PyPI

pip install sceptre-json-resolver

To install from this git repo

pip install git+https://github.com/Sceptre/sceptre-json-resolver.git

Usage/Examples

parameters|sceptre_user_data:
  <name>: !from_json [ <string> ]

parameters|sceptre_user_data:
  <name>: !to_json [ <json object> ]

NOTE: This resolver expects a single-item list argument.

Basic Examples

Take some json object serialize it to a string then pass it to a parameter:

parameters:
   myparam: !to_json [{"key": "value"}]

Note: The string '{"key": "value"}' is passed to myparam

Take a string deserialize it to a json object then pass it to a parameter:

sceptre_user_data:
  myparam: !from_json ['{"key": "value"}']

Note: The object {"key": "value"} is passed to myparam

Nested resolver examples

These use case requires the nested resolver feature in Sceptre version 4.1 and greater.

Load a json object from a file using the sceptre file resolver, serialize the object to a string then pass it to a parameter:

parameters:
  hounds: !to_json [ !file 'hounds.json' ]

Make a request to a REST API using the sceptre-request-resolver, deserialize the response to a json object then pass it to a parameter:

sceptre_user_data:
  hounds: !from_json
    - !request 'https://dog.ceo/api/breed/hound/list'

Release files for sceptre-json-resolver 1.0.0

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

Source distribution (sdist)

Source distribution for sceptre-json-resolver 1.0.0
File Size Uploaded
sceptre_json_resolver-1.0.0.tar.gz 2.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sceptre-json-resolver 1.0.0
File Interpreter ABI Platform
sceptre_json_resolver-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.4 kB

Release files / sceptre_json_resolver-1.0.0.tar.gz

Download URL sceptre_json_resolver-1.0.0.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9420c6ef148210792763310e02e74e22d5c5ed0632af93ee71d7162c1f86f9b1
BLAKE2b-256 checksum
How to use checksums
d68fa1ba83053daa567bd3600997032344ddbe09c4d58113bcb0543cf6246a6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.3 Linux/6.11.0-1012-azure

Release files / sceptre_json_resolver-1.0.0-py3-none-any.whl

Download URL sceptre_json_resolver-1.0.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17a2dbebace901977cb153525c39a98f7ecfc5a78bf3a533eee4bdeb55902f4e
BLAKE2b-256 checksum
How to use checksums
14e7976d998304c71b6ea7436df52479476cf3ef04c159d443fbb571c44aa6b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.3 Linux/6.11.0-1012-azure

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.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