Skip to content

Conversation

@jordanebelanger
Copy link
Contributor

@jordanebelanger jordanebelanger commented Sep 4, 2020

Add support for custom, non-Foundation, JSON encoder & decoder through global variables PostgresNIO._defaultJSONEncoder and PostgresNIO._defaultJSONDecoder (#125, fixes #126).

* add a `PostgresJSONEncoder` protocol with an API that mirrors the Foundation `JSONEncoder`'s decoding function

* add global `_defaultJSONEncoder` variable used in the JSON and JSONB type and that is defaulted to a Foundation `JSONEncoder`

* add a `PostgresJSONDecoder` protocol with an API that mirrors the Foundation `JSONDecoder`'s decoding function

* add global `_defaultJSONDecoder` variable used in the JSON and JSONB type and that is defaulted to a Foundation `JSONDecoder`
@jordanebelanger
Copy link
Contributor Author

Initial comment from previous PR by @tanner0101 #125 (review)

Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@tanner0101 tanner0101 changed the title Support custom json coders Support custom JSON coders Sep 9, 2020
@tanner0101 tanner0101 merged commit 3cf2496 into vapor:master Sep 9, 2020
@tanner0101
Copy link
Member

These changes are now available in 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support custom json decoder and encoder when dealing with JSON/JSONB columns

2 participants