Closed seanrockster closed 1 year ago
you need to configure it to use the right converter. By default it just creates the converter for Newtonsoft
but not System.Text.Json
. You can also configure the backing type.
See: https://github.com/andrewlock/StronglyTypedId#changing-the-defaults-globally
[StronglyTypedId(
backingType: StronglyTypedIdBackingType.Int,
converters: StronglyTypedIdConverter.SystemTextJson)]
public partial struct OrderId { }
Hope that's solved your problem @seanrockster. Feel free to re-open if it doesn't
Hi
Am I missing something? I've read through the blog and I'm thinking the json serializer is auto generated, and I can see its there but still when I return an object from my api the stronlytypedid instance is seralized as an object rather than just its value.
using .net6, StronglyTypedId 0.2.1
{ "id": { "value": "2c2cfdf4-08a2-41fe-af97-063cc72b7fd8" },
Regards