Skip to content

Unexpected type conversion #365

Closed
Closed
@rpdprd

Description

@rpdprd

Is there a way for the JSON document to be stored as is? For example, string "true" and string "42" are converted to boolean ant number respectively.

curl -H "Content-Type: application/json" -X POST -d '{"field1":"xyz","field2":"true","field3":"42","field4":"null"}' http://localhost:3000/example
{
  "field1": "xyz",
  "field2": true,
  "field3": 42,
  "field4": "null",
  "id": 1
}

While it may not be significant in javascript, the resulting document cannot be easily decoded to a map in Go (and maybe other languages) if the expected type is a string.

Thanks

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

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions