Skip to content

Json serialization of longs to strings #70

@CheloXL

Description

@CheloXL

I know this is a very specific case, but... Javascript doesn't support longs. They are trimmed down to the nearest 53bit integer. I have a DB where Ids are longs so I implemented a custom json converter for my webapi that simply writes longs as strings and parse them back from strings (instead of using real js numbers).

I can't do the same with STI, as the serializer it generates simply does a writer.WriteNumberValue(value.Value);. That's fine inside the .net realm, but not in javascript.

I would like an option to be able to specify that longs should be [de]serialized as strings instead of numbers.

Would that be possible? Not sure about any other options that could solve the problem in a generic way.

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