# com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

- **ID:** `java/jackson-jsonparseexception-unexpected-char`
- **Domain:** java
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

Jackson is trying to parse a response or input that contains non-JSON content, typically an HTML page (starting with '<') instead of valid JSON, often due to an incorrect URL, server error response, or missing API endpoint.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Jackson 2.13 | active | — | — |
| Jackson 2.14 | active | — | — |
| Jackson 2.15 | active | — | — |
| Jackson 2.16 | active | — | — |

## Workarounds

1. **Check the actual response from the server by logging the raw response string before parsing. For example: System.out.println("Response: " + responseBody); and verify the URL or API endpoint.** (85% success)
   ```
   Check the actual response from the server by logging the raw response string before parsing. For example: System.out.println("Response: " + responseBody); and verify the URL or API endpoint.
   ```
2. **Use a debug proxy like Fiddler or Charles Proxy to capture the HTTP response and confirm it's HTML instead of JSON. Then fix the request URL or handle HTTP error codes (e.g., 404, 500) gracefully.** (90% success)
   ```
   Use a debug proxy like Fiddler or Charles Proxy to capture the HTTP response and confirm it's HTML instead of JSON. Then fix the request URL or handle HTTP error codes (e.g., 404, 500) gracefully.
   ```
3. **Add a response content-type check before parsing: if (response.getHeader("Content-Type").contains("application/json")) { parse; } else { handle error; }** (80% success)
   ```
   Add a response content-type check before parsing: if (response.getHeader("Content-Type").contains("application/json")) { parse; } else { handle error; }
   ```

## Dead Ends

- **Add @JsonIgnoreProperties(ignoreUnknown = true) to the POJO class** — This annotation ignores unknown JSON properties but does not help when the input is not JSON at all (e.g., HTML). (95% fail)
- **Increase the Jackson parsing leniency with ObjectMapper.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)** — These features relax JSON syntax rules but still require valid JSON structure; they cannot parse HTML. (90% fail)
- **Wrap the parsing in a try-catch and return an empty object** — This hides the error but does not address the root cause (the server returning HTML). The application may behave incorrectly. (80% fail)
