question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deserialize all dictionaries as case-insensetive?

See original GitHub issue

Source/destination types

Dictionary<string, string>

Source/destination JSON

{
  "dictionary" : {
    "key1": "value1",
    "key2": "value2"
}

Expected behavior

I’m able to configure Web API or Core to deserialize dictionary as case-insensetice

Actual behavior

Dictionary is always case sensitive. What makes contract resolver settings critical and potentially breaking:

  • dictionary key comes in upper case
  • camel case contract resolver makes it lower case
  • code throws exception saying key in upper case was not found

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
seclerpcommented, Aug 13, 2021

Thanks @bartelink, I forgot about such an option 😃 Glad to see you here!

1reaction
bartelinkcommented, Aug 13, 2021

@seclerp It’s back! (also did you try https://archive.org/ ?)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deserialize into a case-insensitive dictionary using System. ...
For example, it could deserialize "SoMeNaMe" into a property on an object called SomeName without any additional property naming convention.
Read more >
How to enable case-insensitive property name matching ...
By default, deserialization looks for case-sensitive property name matches between JSON and the target object properties.
Read more >
C# - Case sensitivity in JSON deserialization
Json does case sensitive JSON deserialization. Case sensitivity comes into play when a JSON string is being deserialized into an object. If you' ......
Read more >
How do you fix the wrong-case-sensitivity dictionary setting ...
We might want to use it like a plain old data class. So, we can deserialize JSON or SQL rows or whatever, to...
Read more >
JSON: Dictionary with case insensitive keys
So to prevent problems with case sensitive keys I found this neat trick to ... DeserializeObject<Dictionary<string, object>>(_jsonSample); ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found