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].
Useful 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.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hex_json-0.0.1.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b7d37b4f463b72061d6c508983592413810d5071f953da0b6cf00351512eb42
MD5 9e5202c15ebe14b93f235a455eff8bab
BLAKE2b-256 1821956e4e6384835ce705d13bdd9c4614f3d5139af449544222fcf1d5ed5334

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