Deserializing Escaped JSON Strings
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
One of my OData entities contains a field that holds HTML content as a string. So when I send a JSON request body, I have to escape double quotes and other special characters. However, OData is not deserializing these escaped JSON strings correctly. I have reproduced the issue in a minimal repository here.
POST /api/model
Request:
{
"html": "<div class=\"test\"><\/div>"
}
Response:
{
"Html": "<div class=\\\"test\\\"></div>"
}
Packages:
.NET Core 3.1
Microsoft.AspNetCore.OData 7.5.4
Microsoft.OData.Core 7.8.1
Microsoft.OData.Edm 7.8.1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the POST /api/model reproduction in the linked minimal repository, using the listed Microsoft.AspNetCore.OData and Microsoft.OData package versions. Compare the submitted escaped HTML string with the response; the issue is done when the value round-trips without extra escaping, with a regression test if the repository provides a suitable test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100