-
Notifications
You must be signed in to change notification settings - Fork 234
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
pass escapeHTML flag through generated code #249
base: master
Are you sure you want to change the base?
Conversation
This is great, thank you! My only concern is changing the |
It's an internal interface but yeah, the only alternative I see is to add the flag to |
can this get merged? |
I'm using
and < is getting escaped in serialized values. I'd like to disable that, and this pull request looks apropos, |
IIRC it should work the same way as the standard library. You need to create an encoder and configure it. eg:
|
Doesn't that lose the speed advantage of ffjson.Marshal()...? |
(I wonder if a generation-time flag might be a good idea... then you wouldn't have to thread that option through as much, the generated code would just have true or false hardcoded. It'd work for my use case. And it would avoid changing that interface...?) |
#260 makes it a little hard to play around with this... |
Right, sorry. It should be |
I'm testing the change locally. To use my changed copy, I had to add this to go.mod in the app using ffjson:
And it works! Well, kind of. Oddly, even though I'm calling enc.SetEscapeHTML(false) both places I encode, in one case foo.MarshalJSON is being called, which hardcodes it to true. |
Possible fix for #237