0

I have this Json string which I'll need to convert into an JsonNode.

{"3":"Maybachstraße 14","4":"45659","5":"Recklinghausen","6":"1","7":""}

However, the JSON node always believes that the JSON is this string instead:

{"3":"Maybachstra\u00DFe 14","4":"45659","5":"Recklinghausen","6":"1","7":""}

Code

What am I doing wrong here?

Marvin Klein
  • 1,436
  • 10
  • 33
  • They're not wrong. As far as JSON is concerned, these two are the same. Why do *you* need to distinguish between them? – Sweeper Jul 05 '22 at 09:46
  • It's just two different ways to display [Unicode](https://unicodemap.org/details/0x00DF/index.html) – Fildor Jul 05 '22 at 09:46
  • 1
    [Does this answer your question?](https://stackoverflow.com/questions/58003293/dotnet-core-system-text-json-unescape-unicode-string) – Sweeper Jul 05 '22 at 09:48
  • How do I get the console to output "Maybachstraße 14" then with this JsonNode? – Marvin Klein Jul 05 '22 at 09:54
  • 3
    With your current code: `Console.WriteLine(node.AsObject()["3"].ToString())`. This will cast the node to an object, get the value of key "3" and convert it to a string, which will return "Maybachstraße 14". – gerard Jul 05 '22 at 10:11
  • @MarvinKlein it is just the way it is visualized. If you try Console.WriteLine(tmp["3"]) you will see the way you like it – Serge Jul 05 '22 at 13:41
  • Does this answer your question? [dotnet core System.Text.Json unescape unicode string](https://stackoverflow.com/questions/58003293/dotnet-core-system-text-json-unescape-unicode-string) – Charlieface Jul 05 '22 at 15:12

0 Answers0