Opened 6 years ago

Closed 2 months ago

#15091 closed New feature (fixed)

Ease using a custom JSON encoder with serialize()

Reported by: knurpsburps Owned by: berkerpeksag
Component: Core (Serialization) Version: 1.2
Severity: Normal Keywords:
Cc: jschrewe@…, kmike84@…, berker.peksag@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm trying to use a custom json encoder and the docs tell me how to write one. Sdly they are missing any clue on how to use this encoder. At least I haven't found anything in the docs.

Change History (10)

comment:1 follow-up: Changed 6 years ago by gabrielhurley

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

I'm guessing this is in reference to the serialization topic guide (particularly the last few paragraphs of the JSON section).

I'll agree there probably should be a section in the topic guide on installing/using your own serializer. Relevant information in the source code and in the settings reference.

comment:2 in reply to: ↑ 1 Changed 6 years ago by knurpsburps

  • Cc jschrewe@… added

Replying to gabrielhurley:

I'm guessing this is in reference to the serialization topic guide (particularly the last few paragraphs of the JSON section).

Yes.

I'll agree there probably should be a section in the topic guide on installing/using your own serializer. Relevant information in the source code and in the settings reference.

So, from what I read from these links is that in order to use a different encoder a new serializer must be used? The documentation in that section seemed to imply that encoders could be changed without that. But maybe that's just hope on my part.

But anyway, I think at least a hint in the docs would make this a lot clearer.

comment:3 Changed 6 years ago by knurpsburps

  • Cc jschrewe@… added; jschrewe@… removed

comment:4 Changed 5 years ago by kmike

  • Cc kmike84@… added

comment:5 Changed 5 years ago by jaddison

  • Severity set to Normal
  • Type set to Bug

comment:6 Changed 5 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:7 Changed 5 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:8 Changed 2 months ago by berkerpeksag

  • Cc berker.peksag@… added
  • Has patch set
  • Owner changed from nobody to berkerpeksag
  • Status changed from new to assigned

Indeed it is impossible to pass a custom encoder without subclassing the JSON serializer. I made cls customizable in my PR.

comment:9 Changed 2 months ago by timgraham

  • Component changed from Documentation to Core (Serialization)
  • Summary changed from Serializer docs contain nothing on how to use a custom encoder to Ease using a custom JSON encoder with serialize()
  • Triage Stage changed from Accepted to Ready for checkin
  • Type changed from Bug to New feature

comment:10 Changed 2 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In c1b6f554:

Fixed #15091 -- Allowed passing custom encoder to JSON serializer.

Note: See TracTickets for help on using tickets.
Back to Top