‘<‘ is an invalid start of a value means the text you passed to System.Text.Json starts with the character <, so it is HTML or XML, not JSON. In practice it is almost always an error page, a login page or a proxy page returned instead of your API’s JSON. A related message, ‘X’ is an invalid start of a property name, means the JSON is not strict: single quotes, unquoted names or comments. This post covers both, with the exact messages I reproduced on .NET 10 and the fix for each.

- ‘<‘ is an invalid start of a value: what the error means
- Fix: check what the server really returned
- ‘X’ is an invalid start of a property name: the causes
- Fix 1: send valid JSON (best fix)
- Fix 2: allow comments and trailing commas
- Fix 3: apply the options in ASP.NET Core
- Fix 4: you cannot change the source and it uses single quotes
- What was tested and what was not
- Summary
- Invalid start of a value FAQ
‘<‘ is an invalid start of a value: what the error means
This is the message, as thrown when the input begins with an HTML page:
System.Text.Json.JsonException: '<' is an invalid start of a value.
Path: $ | LineNumber: 0 | BytePositionInLine: 0.
Path: $ is the document root, and line 0, position 0 is the first character. The parser got to the very first character and found < instead of {, [ or a value. Typical sources are an HTTP 500 or 404 page, a sign-in redirect, a reverse proxy error page, or a URL that points to a web page instead of an API. An empty body gives a different message: The input does not contain any JSON tokens.
Fix: check what the server really returned
Before you deserialize, look at the status code, the content type and the first characters of the body. This sample, run against a local server that answered 200 with an HTML sign-in page, shows both the exception from ReadFromJsonAsync and the check that avoids it:
using System.Net.Http.Json;
using var client = new HttpClient();
var response = await client.GetAsync("http://localhost:5114/people");
var mediaType = response.Content.Headers.ContentType?.MediaType;
if (!response.IsSuccessStatusCode || mediaType != "application/json")
{
var text = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Not JSON: {(int)response.StatusCode} {mediaType}. Starts with: {text[..Math.Min(text.Length, 40)]}");
return;
}
var person = await response.Content.ReadFromJsonAsync<Person>();
public record Person(string FirstName);
Output for the HTML page:
Not JSON: 200 text/html. Starts with: <!DOCTYPE html><html><body>Please sign i
Without the check, ReadFromJsonAsync threw the '<' is an invalid start of a value exception above. Once you can see the body, fix the real cause: the wrong URL, a missing authentication header, or the server error. For a 4xx or 5xx status you can also call response.EnsureSuccessStatusCode() first so the status is reported instead of a parsing error.
‘X’ is an invalid start of a property name: the causes
System.Text.Json follows the JSON standard (RFC 8259) strictly. Property names and strings need double quotes. Newtonsoft.Json is more forgiving, so this error often appears right after switching libraries. The character in the message tells you the cause. I ran each of these inputs against Deserialize<Person> with default options:
''' is an invalid start of a property name. Expected a '"'. Path: $ | LineNumber: 0 | BytePositionInLine: 2.
'F' is an invalid start of a property name. Expected a '"'. Path: $ | LineNumber: 0 | BytePositionInLine: 2.
'/' is invalid after a value. Expected either ',', '}', or ']'. Path: $ | LineNumber: 0 | BytePositionInLine: 21.
The JSON object contains a trailing comma at the end which is not supported in this mode. Change the reader options.
| Input | Error character | Allowed with an option? | Fix |
|---|---|---|---|
{ 'name': "Ann" } (single quotes) | ' | No | Fix the source JSON |
{ name: "Ann" } (unquoted name) | F (first letter) | No | Fix the source JSON |
| Comment after a value or a comma | / | Yes | ReadCommentHandling = Skip |
{ "name": "Ann", } (trailing comma) | trailing comma message | Yes | AllowTrailingCommas = true |
Position values start at 0, so BytePositionInLine: 2 is the third character of the line.
Fix 1: send valid JSON (best fix)
Change the producer so it writes standard JSON with double quotes. Invalid, then valid:
{ 'FirstName': "Ann" }
{ "FirstName": "Ann" }
If you build JSON by string concatenation, switch to JsonSerializer.Serialize(obj), which always produces valid JSON. More examples: serialize and deserialize with System.Text.Json.
Fix 2: allow comments and trailing commas
Config files and hand-edited JSON often contain comments or trailing commas. Allow them with JsonSerializerOptions (Allow some kinds of invalid JSON (Microsoft Learn)):
using System.Text.Json;
var options = new JsonSerializerOptions
{
ReadCommentHandling = JsonCommentHandling.Skip, // ignore // and /* */ comments
AllowTrailingCommas = true // accept { "a": 1, }
};
var person = JsonSerializer.Deserialize<Person>(json, options);
public record Person(string FirstName);
With these options the comment and trailing-comma inputs deserialized to Ann, while single quotes, unquoted names, the HTML page and the empty string still threw. Create the options object once and reuse it.
Fix 3: apply the options in ASP.NET Core
If the error comes from a request body in your API, set the same options globally. For minimal APIs:
builder.Services.ConfigureHttpJsonOptions(o =>
{
o.SerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;
o.SerializerOptions.AllowTrailingCommas = true;
});
For controllers, the equivalent is:
builder.Services.AddControllers()
.AddJsonOptions(o =>
{
o.JsonSerializerOptions.ReadCommentHandling = JsonCommentHandling.Skip;
o.JsonSerializerOptions.AllowTrailingCommas = true;
});
I posted a body containing a comment to a minimal API endpoint. Without the options it returned HTTP 400 with '/' is an invalid start of a property name in the error. With the options it returned 200. Single quotes were still rejected with 400 in both cases.
Fix 4: you cannot change the source and it uses single quotes
System.Text.Json has no option for single quotes or unquoted names. If a third-party system sends that format, parse that one payload with Newtonsoft.Json, which accepted both of my test inputs (see Migrate from Newtonsoft.Json to System.Text.Json (Microsoft Learn)):
// dotnet add package Newtonsoft.Json
var person = Newtonsoft.Json.JsonConvert.DeserializeObject<Person>("{ 'FirstName': 'Ann' }");
Keep System.Text.Json everywhere else. Adding Newtonsoft.Json support in ASP.NET Core explains how to switch a whole API. If your message is a type mismatch instead, such as a number where a string is expected, see the JSON value could not be converted to System.String.
What was tested and what was not
- Run on macOS with .NET SDK 10.0.401 (System.Text.Json 10, Newtonsoft.Json 13.0.4): every message above, the options, the HttpClient check against a local server returning an HTML page, and the minimal API with and without the options.
- Not tested: the controller version of
AddJsonOptions(it uses the same options), Blazor and other hosts, and real third-party APIs. Wording and positions of messages can differ slightly between .NET versions.
Summary
'<' is an invalid start of a value: you received HTML or XML. Log the status, content type and first characters of the body, then fix the URL, authentication or server error.invalid start of a property name: the JSON has single quotes, unquoted names or comments. Fix the source, or allow comments and trailing commas with options.- Only Newtonsoft.Json accepts single quotes and unquoted names.
Found this useful?
Bookmark this page and share it with your team. Get new .NET, cloud and database tutorials in your inbox.
Invalid start of a value FAQ
What does “‘<‘ is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0” mean?
The text being parsed begins with a less-than sign, so it is HTML or XML instead of JSON, usually an error, login or proxy page. Check the response status, content type and first characters before deserializing.
Why do I get “is an invalid start of a property name” in System.Text.Json?
A property name is not wrapped in double quotes, or a comment sits where a name should be. System.Text.Json accepts only strict JSON, with options for comments and trailing commas but none for single quotes or unquoted names.
Why did this JSON work with Newtonsoft.Json but not System.Text.Json?
Newtonsoft.Json accepts several non-standard forms by default, including single quotes and unquoted names. System.Text.Json is strict by design, so fix the JSON source or parse that payload with Newtonsoft.Json.
Which of these was your cause? Tell us in the comments.

thanks a lot. this page help me to solve my problem.
Hi Zhaleh- Glad it helped you resolve the issue! Thanks for your comments.
They should have provided JsonDocumentOptions for forgiving the single quote and probably other stuff I have not found yet. I already have json in production with single quotes.
This hack is not ideal but worked for me. Yeah, I don’t have an issue with the added parse time for now.
var tmp = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
json = Newtonsoft.Json.JsonConvert.SerializeObject(tmp);
doc = JsonDocument.Parse(json, documentOptions);
Hi Robert, Thanks for your query and for sharing your workaround for resolving the issue.
Thanks for explaining this, saves me a lot of time!
Thank you Martin- Glad it helped you!
This makes the System.Text.Json unusable. I read JSON from thirdparties and require some slack in the JSON interpretation for my intergrations to work. Being to strict with the RFC just kills the use of this lib.
Thanks Michael- I understand your concerns on using System.Text.Json limitations with third-party. Considering long-term benefits it is recommended to follow RFC specifications and guidelines.