Skip to main content

Convert [Python dictionary | ASCII JSON string] into hexadecimal string.

Project description

hex-json

Convert [python dictionary | ASCII JSON string] into hexadecimal string.
Restore from a hexadecimal string to [python dictionary | ASCII JSON string].
Userful for ethereum transaction data signature.

https://github.com/Sobolev5/hex-json

Install

To install run:

pip install hex-json

Convert and restore dict

d = {"hello": "world"}
hex_s = hex_serialize(d)
print(hex_s) # 0x10b9af5bde033362715ac3e14a8e3a374e572b9923e4d

d = hex_deserialize(hex_s)
print(d) # {'hello': 'world'}
print(type(d)) # <class 'str'>

Convert and restore ASCII JSON string

d = '{"hello": "world"}'
hex_s = hex_serialize(d)
print(hex_s) # 0x389e07d8b54506b764401133595ffdc3b1729818953c64e47bc3ddbac98cea

d = hex_deserialize(hex_s)
print(d) # {"hello": "world"}
print(type(d)) # <class 'str'>

Tests

tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

hex_json-0.0.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file hex_json-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: hex_json-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.2

File hashes

Hashes for hex_json-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01acfadf2cbf16ab902a94f72242f08026c495b1ebf90c8e82aac66ddea871b0
MD5 8bbb256ca9b23769745aed398ec64e1f
BLAKE2b-256 c718287854d50e218313cf796564175c77305170c1e1575d74df6471481f3b66

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