# System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.id

**Code:** `The JSON value could not be converted` · **Category:** .NET · **Seen on:** .NET

System.Text.Json couldn’t map a JSON value to the target .NET type — e.g. "42" (string) to int, null to a non-nullable type, or wrong enum value.

## Meaning

System.Text.Json is stricter than Newtonsoft: numbers in strings, case differences, enums as strings and comments are rejected unless configured.

## Common causes

- Number sent as a string
- Enum sent as text without JsonStringEnumConverter
- null into a non-nullable value type
- Property type differs from the JSON shape (object vs array)

## Quick fix

1. Enable NumberHandling = AllowReadingFromString
2. Add JsonStringEnumConverter
3. Fix the DTO type or make it nullable

## Detailed fix by platform

### C#

1. 

```csharp
builder.Services.ConfigureHttpJsonOptions(o => {
    o.SerializerOptions.NumberHandling = JsonNumberHandling.AllowReadingFromString;
    o.SerializerOptions.Converters.Add(new JsonStringEnumConverter());
});
```


## How to diagnose

1. **Path** — $.path in the message
2. **JSON** — Actual value
3. **Options** — Serializer settings

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/dotnet/json-value-could-not-be-converted)
