matrix-org / python-canonicaljson

Canonical JSON
Apache License 2.0
31 stars 15 forks source link

Ordering is incorrect for large keys (?) in an object #21

Closed Half-Shot closed 5 years ago

Half-Shot commented 5 years ago
>>> canonicaljson.encode_canonical_json({"ciphertext":{"T5jXYOv\/XAgAT5Z0Ld1tPfWIYZftmduZSmbS4Fu1l1o":{"body":"123","type":0},"iFgnZ+EKIvtyVOdOVFEoo\/VKOrWjjZd7YDGWHDOIf2Y":{"body":"456","type":0}}})
b'{"ciphertext":{"T5jXYOv\\\\/XAgAT5Z0Ld1tPfWIYZftmduZSmbS4Fu1l1o":{"body":"123","type":0},"iFgnZ+EKIvtyVOdOVFEoo\\\\/VKOrWjjZd7YDGWHDOIf2Y":{"body":"456","type":0}}}'

Which should surely be the other way around?

Half-Shot commented 5 years ago

Nvm, my application was sorting alphabetically, not by ordinal