Allow mapping JSON to Dictionary<string,string>
See original GitHub issueHello! I have question. I used next entity with jsonb
type column:
class Entity
{
public int Id {get;set;}
[Column(TypeName = "jsonb")]
public Dictionary<string, string> Name {get;set;}
}
I want to use order by
for example how Postgres SQL script:
SELECT "Id", "Name" FROM public."Entities" ORDER BY "Name"->>'en' DESC
Is it possible to do this sorting on EF? I searched in the documentation for this, as well as on the vastness of stackoverflow and in issues github, but I did not find an answer to this question.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How can I deserialize JSON to a simple Dictionary<string ...
Just send JSON string in to deserializeToDictionary function it will return non strongly-typed Dictionary<string, object> object. Old code
Read more >Convert a JSON String to a Dictionary in Python
To convert a JSON string to a dictionary in Python, you can leverage the “JSON” module and its “loads()” function. By passing the...
Read more >json string to dictionary
I have a simple json string {"1":10,"2":25,"3":1,"4":124,"7":567} I have a Dictionary Dictionary Gameitems = new Dictionary ();...
Read more >How do I create JSON Object from Dictionary(String, String)
I want to translate pairs from dictionary (Key:Value) given like this or otherwise transparently: to this: Where “fields” is main object, ...
Read more >How to Map Nested JSON Objects to a .NET Dictionary
How to Map Nested JSON Objects to a .NET Dictionary. Sometimes a public JSON API responds in a format that you can't control....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The provider currently doesn’t support mapping
Dictionary<string,string>
to JSON; you can either map a .NET POCO (for strongly-typed documents with a fixed schema) or JsonDocument (for weakly-typed documents with varying schemas). See the docs for more details. If you use one of these two mapping techniques, you can generate a JSON field lookup in an ORDER BY just as you would in a WHERE clause.Keeping open to track mapping
Document<string,string>
.Yep - that should take care of serialization. The only thing this doesn’t take care of is querying (e.g. filtering based on the value inside the dictionary).