Skip to content

bool values produce capitalized strings when used as dict keys #613

@eltoder

Description

@eltoder

What did you do?

>>> import ujson
>>> ujson.dumps({True: 1, False: 2, None: 3})
'{"True":1,"False":2,"null":3}'

What did you expect to happen?

I expected bool values to be serialized as lower-case strings "true" and "false" as standard in JSON. This is what happens with the standard json library:

>>> import json
>>> json.dumps({True: 1, False: 2, None: 3})
'{"true": 1, "false": 2, "null": 3}'

Note that None did produce the expected lower-case "null" value.

What actually happened?

The strings were capitalized, which suggests that they were produced by Python's str or repr.

What versions are you using?

  • OS: Debian 11
  • Python: 3.9.16
  • UltraJSON: 5.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions