Skip to content

Use PostgresNIO's default JSON coders

Compare
Choose a tag to compare
@tanner0101 tanner0101 released this 09 Sep 21:17
cbbe3ef
This patch was authored by @jordanebelanger and released by @tanner0101.

This adds support for using non-Foundation JSON coders when decoding and encoding JSON columns (#195).

For example, if you want to use the pure-swift JSON coders, you can now do this during the configuration of your application:

import PureSwiftJSON

PostgresNIO._defaultJSONDecoder = PSJSONDecoder()
PostgresNIO._defaultJSONEncoder = PSJSONEncoder()

Do note that the JSON coders used here MUST be thread safe internally.