Opened 7 years ago

Closed 16 months ago

#15091 closed New feature (fixed)

Ease using a custom JSON encoder with serialize()

Reported by: knurpsburps Owned by: Berker Peksag
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 Changed 7 years ago by Gabriel Hurley

Triage Stage: UnreviewedAccepted

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 7 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 7 years ago by knurpsburps

Cc: jschrewe@… added; jschrewe@… removed

comment:4 Changed 7 years ago by Mikhail Korobov

Cc: kmike84@… added

comment:5 Changed 7 years ago by James Addison

Severity: Normal
Type: Bug

comment:6 Changed 6 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:7 Changed 6 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:8 Changed 16 months ago by Berker Peksag

Cc: berker.peksag@… added
Has patch: set
Owner: changed from nobody to Berker Peksag
Status: newassigned

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

comment:9 Changed 16 months ago by Tim Graham

Component: DocumentationCore (Serialization)
Summary: Serializer docs contain nothing on how to use a custom encoderEase using a custom JSON encoder with serialize()
Triage Stage: AcceptedReady for checkin
Type: BugNew feature

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

Resolution: fixed
Status: assignedclosed

In c1b6f554:

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

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