Closed marchy closed 1 year ago
I've submitted up a PR (https://github.com/ngocnicholas/airtable.net/pull/66) that implements helpers for both primitive fields as well as arrays, lists, collections and enumerables, while also exposing an GetFieldAsJson(..)
if you do want a convenience to access the System.Text.Json JsonElement
directly (as opposed to getting an object
back that you have to cast each time).
Has this been pushed out in a new version yet by chance?
A new version of Airtable.net will be released next week.
Enhancements included in new release of 1.3.0.
After the move to System.Text.Json, parsing out fields manually has become really cumbersome due to an extra cast to
JsonElement
needed, which has to be wrapped in braces (due to the forced casting syntax) and then the new.GetString()
/GetBoolean()
etc. methods used to parse the appropriate values.This also leaks the System.Text.Json abstraction outwards through the Airtable.NET library, which is further out than it ought to be.
Example:
Instead I propose generic
GetField<T>
methods added that hide away all the casting complexity – and indeed hide away the System.Text.Json abstraction altogether.Suggested: