Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/json: marshaller does not provide Base64Url support #14804

Open
cyberphone opened this issue Mar 13, 2016 · 5 comments
Open

encoding/json: marshaller does not provide Base64Url support #14804

cyberphone opened this issue Mar 13, 2016 · 5 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@cyberphone
Copy link

  1. Go version: 5.3
  2. Operating system: Windows 8.1 64-bit
  3. What did you do?
    https://play.golang.org/p/k1Wgec8cVB
  4. What did you expect to see?
    I had hoped that there would be a field option allowing you to override the default encoding because Base64Url is nowadays the preferred format in standards including IETF's JOSE
  5. What did you see instead?
    No such option :-)
@OneOfOne
Copy link
Contributor

What's wrong with doing it client side instead of making the json encoder do mime sniffing on the data?

img.src = 'data:image/png;base64,' + data.Blob;

@cyberphone
Copy link
Author

@OneOfOne There's nothing wrong with sniffing in a browser scenario but I'm targeting another class of applications where there is no room for such measures: https://cyberphone.github.io/openkeystore/resources/docs/jsonsignatures.html

Yes, an option must also work for unmarshalling.

@OneOfOne
Copy link
Contributor

It's rather trivial to implement your own type for that though.

https://play.golang.org/p/FYFtvrdWnq

@cyberphone
Copy link
Author

@OneOfOne Indeed I could but you should consider this issue related to a bunch of issues which makes the current Marshaller/Unmarshaller close to useless in my context:
#14750
#14749
#14135

@bradfitz bradfitz changed the title JSON marshaller does not provide Base64Url support encoding/json: marshaller does not provide Base64Url support Apr 9, 2016
@bradfitz bradfitz added this to the Unplanned milestone Apr 9, 2016
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2024
@seankhliao
Copy link
Member

see #63397 which proposes a struct tag of format base64url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants