Skip to content

Convert an AttributeDict with bytes values to a json string #782

Closed
@AlbertChanX

Description

@AlbertChanX
  • Version: 4.2.1

What was wrong?

w3.eth.getTransaction() returns an AttributeDict, which I want to send as a string, say over HTTP. I couldn't find a convenient way to make this conversion.

How can it be fixed?

A new method that converts an AttributeDict to a json string:

txn = w3.eth.getTransaction(txn_hash)
txn_json = Web3.toJson(txn)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions