postgres-kit icon indicating copy to clipboard operation
postgres-kit copied to clipboard

Add support for nested JSON

Open tetraoxygen opened this issue 4 years ago • 5 comments

This PR adds support for encoding nested JSON. For example, you can encode a Codable datatype that includes other Codable types.

You can use this with Codable's polymorphism support to add small bits of data that support polymorphism by having a type annotation outside a nested object you intend to decode.

tetraoxygen avatar Jan 20 '22 02:01 tetraoxygen

I've added tests for nested encoding, which is all I materially changed. I'm also happy to go write nested decode tests (though those just use Swift's standard JSONDecoder) if it would be useful.

tetraoxygen avatar Feb 04 '22 00:02 tetraoxygen

@0xTim Following up on this — should I write more tests or do the ones I've added do the job?

tetraoxygen avatar Feb 10 '22 04:02 tetraoxygen

I believe #207 would be solved by this PR (without the PostgresJSONCodable workaround)

tetraoxygen avatar Apr 14 '22 00:04 tetraoxygen

Indentation should be fixed now

tetraoxygen avatar Jun 30 '22 03:06 tetraoxygen

I have also this trouble. Thanks for the nice PR.

sidepelican avatar Sep 22 '22 10:09 sidepelican