Skip to content

Would like to be able to serialize int64 as string #120

Open
@mylanconnolly

Description

@mylanconnolly

Hello all,

I am working on a project that I'd like to utilize jsonapi for.

I'm running into a snag because our ID format is large int64s (like 1362085645204177151). These overflow when just serializing to JSON (the last few digits end up being just zeros), so when using just plain JSON serialization in Go, I'd do something like:

type Example struct {
  SomeID int64 `json:"someId,string"` // The string argument tells the json encoder to format this as a string
}

This doesn't seem to be implemented in this package, and I'd not be opposed to doing the legwork myself, but I just wanted to see if this is something that would be approved before I got too far.

Thanks!

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