Skip to content

Integers as keys in dictionaries #10

@willemt

Description

@willemt

In JSON keys MUST be strings. It would be handy if it was possible to use integers as keys like so:

{
  1: "foo",
  2: "bar"
}

Example usecase
I have a REST service that represents assignments between objects like below. It would be better if the REST service could use integers instead of strings for keys.

{
    "assignments": {
        "2387": 35,
        "2477": 39,
        "2574": 30,
        "2575": 33,
        "2576": 37,
        "2645": null,
        "2741": 36,
        "2742": 32,
        "2743": 31,
        "2745": 31,
        "2746": 39,
        "2747": null,
        "2748": 32,
        "2819": 33,
        "2821": null,
        "2823": 38,
        "3038": 36
    }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions