Skip to main content

json2ast

The JSON to Python AST converter you never knew you needed


Description

This package is meant to work in the opposite direction of the ast2json package which takes a Python AST object as input and produces a JSON structure as output. The one function, json2ast expects a Python dictionary created by ast2json and returns a replication of the AST objects used to create that dictionary.

Example

import ast
from ast2json import ast2json
from json2ast import json2ast

tree = ast.parse(open("test_scripts/test0.py").read())
json_tree = ast2json(tree)

ast_tree = json2ast(json_tree)

Metadata

Release files for json2ast 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 json2ast 1.0.1
File Size Uploaded
json2ast-1.0.1.tar.gz 4.3 kB Details

Built distribution (wheel)

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

Total release size: 8.9 kB

Release files / json2ast-1.0.1.tar.gz

Download URL json2ast-1.0.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
651948a0e6e68c5f5d65d16e9c45db66beed0b32fd94abc49725e86f80c90a92
BLAKE2b-256 checksum
How to use checksums
7fa6c56a4942927252f332cac5a888abd864fdf937582e47a57334e144607936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

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

Download URL json2ast-1.0.1-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c190d95adfb098ecd351751eb1b0068c900392f50a813f8dcdcdfddf56c7ac0
BLAKE2b-256 checksum
How to use checksums
f044a6383984da63df0515a70486e49c273f33eda869eae7097fc57d21b9ca5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

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