snowflake-db-net-client icon indicating copy to clipboard operation
snowflake-db-net-client copied to clipboard

Mapping $id or $ref into properties.

Open brandorf opened this issue 2 years ago • 1 comments

I've got some inner objects that are using $id as property names that need to be mapped to an object. Normally I would modify the json serializer settings to ignore references, but this seems to not be exposed to us when using the Snowflake client?

Short version, given an object like so: "emid": { "$id": "63484e6eab783af4c4072539" }

With a poco:

public class Emid { [JsonProperty("$id")] public string id { get; set; } }

In the final deserialized object coming back from QueryAsync, that ID will alway be null, is there a setting I'm overlooking?

brandorf avatar Aug 31 '23 21:08 brandorf

Hello! You can override json serializer options - you can pass them in SnowflakeClient constructor or you can set it directly with this method: SnowflakeDataMapper.SetJsonMapperOptions(jsonSerializerOptions).

fixer-m avatar Sep 06 '23 19:09 fixer-m