json.loads accepts several inputs that CPython rejects, and one of them loses data without reporting anything · Issue #19581 · micropython/micropython · GitHub
Skip to content

json.loads accepts several inputs that CPython rejects, and one of them loses data without reporting anything #19581

Description

@Tangerino

Port, board and/or hardware

ESP32

MicroPython version

MicroPython v1.26.1 on 2025-09-11; Generic ESP32 module with SPIRAM with ESP32
Type "help()" for more information.

Reproduction

MicroPython v1.26.1 on 2025-09-11; Generic ESP32 module with SPIRAM with ESP32
Type "help()" for more information.

import json
print(json.loads('{"a": }')) # {} — key gone, no error
print(json.loads('{"a": 1 "b": 2}')) # {'a': 1, 'b': 2}
print(json.loads('{"a": 01}')) # {'a': 1}
print(json.loads('{"a": 1,}')) # {'a': 1}
{}
{'a': 1, 'b': 2}
{'a': 1}
{'a': 1}

Expected behaviour

CPython rejects all tests

Observed behaviour

CPython rejects all tests

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextmodRelates to extmod/ directory in source

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions