Skip to content

Consider using IndexMap: json order is random after a 33 keys in map #378

@ritchie46

Description

@ritchie46

This python snippet wouldn't round trip if simd-json was used:

import json

obj = {c: None for c in "abcdefghijklmnopqrstuvwxyz1234567"}
s = json.dumps(obj)
assert json.loads(s) == obj

This is because Object uses a hashmap which doesn't preserve the order of the json string keys. This can be resolved by using
I would like to consider using indexmap, which has excellent performance, AND guarantees index order.

This issue was discovered in: pola-rs/polars#17439

If this is accepted, I am willing to make a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions