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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file json2ast-1.0.1.tar.gz.

File metadata

  • Download URL: json2ast-1.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for json2ast-1.0.1.tar.gz
Algorithm Hash digest
SHA256 651948a0e6e68c5f5d65d16e9c45db66beed0b32fd94abc49725e86f80c90a92
MD5 a5000a8afb129a891d644a72be7c6c61
BLAKE2b-256 7fa6c56a4942927252f332cac5a888abd864fdf937582e47a57334e144607936

See more details on using hashes here.

File details

Details for the file json2ast-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: json2ast-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for json2ast-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c190d95adfb098ecd351751eb1b0068c900392f50a813f8dcdcdfddf56c7ac0
MD5 9890e0efa1a58112a8ebb226b6ac3353
BLAKE2b-256 f044a6383984da63df0515a70486e49c273f33eda869eae7097fc57d21b9ca5b

See more details on using hashes here.

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