Hi @AnonymousKKYY ,Welcome to Microsoft Q&A,
In JSON, the backslash (\
) is a special character, so it needs to be written as \\
to represent a real \.
In C# strings, the backslash is also a special character, so in C# code, the \\
in JSON needs to be escaped once more, written as \\\\
.
After JSON parsing, stu.Id
will correctly contain \dddd
without losing the backslash.
string jsonString = "{\"name\": \"user\", \"id\": \"\\\\dddd\"}";
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.