Closed TiagoBrenck closed 9 months ago
It is a System.Json.Text
behavior and I found a solution.
Use [JsonNumberHandling(JsonNumberHandling.AllowReadingFromString)]
for the integers and create a custom converter for the DateTime.
I am curious about the motivation for moving away from Newtonsoft
, but I am sure there are valid reasons for it.
Thanks
Hi,
I noticed that on version
1.1.6
, you changedNewtonsoft.Json
toSystem.Text.Json
and I believe things arent working well. After the change, your library is only able to serialize string types.For example, given this Airtable sample:
And this C# class:
When I call
var airtableResult = await airtableBase.ListRecords<AirtableModel>("Sample", maxRecords: 100, view: "Github Sample");
, this exception is thrown:However, changing the property
id
to typestring
works.My production code is using the library version
1.1.5
, with a C# model that hasint
,DateTime
andnullable int
datatypes, and the conversion works good. Updating the version to anything from1.1.6
to the latest1.4.0
, causes the Json exception.It would be really nice to have the serialization fixed, supporting all the common types like integers and datetime.
Thanks