Skip to main content

The opposite of ast2json

Project description

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)

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

json2ast-1.0.1.tar.gz (4.3 kB view hashes)

Uploaded Source

Built Distribution

json2ast-1.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page