JamesNK / Newtonsoft.Json

Json.NET is a popular high-performance JSON framework for .NET
https://www.newtonsoft.com/json
MIT License
10.72k stars 3.25k forks source link

\* Bugs #2579

Open eatage opened 3 years ago

eatage commented 3 years ago

Source/destination types


// Put the types you are serializing or deserializing here
Newtonsoft.Json.Linq.JObject

### Source/destination JSON

```javascript
{"key":"123\*"}

### Expected behavior

<!-- What did you expect to happen? -->

### Actual behavior
Success!!!
<!-- What happened instead? -->

### Steps to reproduce
fails: Newtonsoft.Json.JsonReaderException:“Bad JSON escape sequence: \*. Path 'key', line 1, position 13.”
```csharp
// Your calls to Newtonsoft.Json here
Newtonsoft.Json.Linq.JObject json = Newtonsoft.Json.Linq.JObject.Parse(jsonText);
elgonzo commented 3 years ago

Not a bug.

The exception is truthful. The example you provided is not valid Json, because \* is not one of the escape sequences for Json strings as declared by the Json specification. See for yourself in the Json spec, section 9 "strings", page 4: https://www.ecma-international.org/publications-and-standards/standards/ecma-404/