Skip to content

JSON: Allow weakly-typed mapping via Dictionary #29825

@roji

Description

@roji

#28871 tracks weakly-typed JSON mapping via JsonDocument/JsonElement, where the JSON document schema varies and so a strongly-typed model isn't appropriate.

We can also allow simply mapping arbitrary Dictionary types - this corresponds to how many people use

  • This intersects with #28688 (primitive collections in JSON).
  • Both keys and values should support any valid JSON data type (string, int...).
  • However we could also support Dictionary<string, object>, to map an entire hierarchy. See #26903 on this (currently seemed blocked by property bag detection).
  • This should be supported at the top-level, so that the JSON object as a whole is mapped as a single dictionary (see e.g. this issue). This would mean supporting OwnsOne(x => x.Json, builder => { builder.ToJson(); }) where x.Json is a Dictionary.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions