-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Column handling with unknown/dynamic structure #32043
Comments
Duplicate of #29825 and/or #28871. EF doesn't yet support dynamic JSON mapping; it currently requires that the JSON document shape be known in advance, and modeled via a .NET POCO type. #29825 tracks allowing mapping dynamic JSON as a dictionary, whereas #28871 tracks doing so via the the System.Text.Json APIs (JsonDocument/JsonElement). |
Thanks for your fast response. I have set my votes :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello everyone,
I’m attempting to use the JSON columns feature in Entity Framework Core with a database where JSON data is stored as strings. The problem is that the structure of these JSON objects varies and is not known at compile time.
I’ve tried to handle this using dynamic, ExpandoObject, JsonObject, and Dictionary, but haven’t had any success.
Here’s a simplified version of my entity:
My goal is to create a web API that allows users to apply filters to the JSON content (similar to OData). Currently, I’m serializing/deserializing my JSON as a string, which doesn’t allow for server-side dynamic querying/filtering. This has to be done client-side, which isn’t very efficient.
So basically i want to do something like that (pseudo code):
Is it somehow possible to query dynamic jsons? Should I resort to writing SQL queries? Can dynamic linq help? Any guidance or suggestions would be greatly appreciated.
Thank you for your help!
EF Core version: 8.0 RC1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 8.0 RC1
Operating system: Windows
IDE: Visual Studio 2022 17.8.0 Preview 2
The text was updated successfully, but these errors were encountered: