matrix-org / matrix-org/python-canonicaljson

Expose functions that return `str` instead of `bytes`

Open
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
30
Forks
15
PR merge metrics
No merged PRs in 30d

Description

It would be nice to get canonical json as str, as a drop-in replacement for json.dumps. Right now using encode_canonical_json for that means going back and forth between str and bytes which is wasteful.
Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the encode_canonical_json entry point and compare its bytes result with json.dumps, which returns str. Add the requested str-returning API and verify that canonical JSON output is available without a str/bytes conversion; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.