Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0
Json.NET was given text that isn’t valid JSON — commonly HTML, a BOM, or an already-serialized string.
Seen on:
.NET
Meaning
Same root causes as other JSON parse errors: HTML/error responses, double-serialized JSON (a JSON string containing JSON), or a file starting with a BOM/invalid character.
Common causes
- HTML or error page instead of JSON
- Double-serialized JSON (string wrapping JSON)
- Invalid characters/BOM at start
- Truncated responses
⚡ Quick fix
- Log the raw text before parsing
- Deserialize once (avoid JsonConvert.SerializeObject on an existing JSON string)
- Check status codes first
Detailed fix by platform
C#
- csharp
var raw = await res.Content.ReadAsStringAsync(); logger.LogDebug("Raw: {Raw}", raw); var obj = JsonConvert.DeserializeObject<Order>(raw);
How to diagnose
- Raw — First characters
- Serialization — Done twice?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in .NET
- NullReferenceException System.NullReferenceException: Object reference not set to an instance of an object
- FileNotFoundException assembly Could not load file or assembly 'X, Version=…' or one of its dependencies
- InvalidOperationException InvalidOperationException: Unable to resolve service for type 'X' while attempting to activate 'Y'
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026