无法使用 objectmapper 从 html 字符串中读取值

Unable to readvalue from html string using objectmapper

public void testJson() {

        ObjectMapper mapper = new ObjectMapper();
        try {
            String htmlString = mapper.readValue("<!Doctype>", String.class);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at [Source: (String)"";

如何解决这个问题?

我最终使用了 gson。

JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject();