【Jackson】Json文字列変換時のJsonParseException: Unexpected character ('X' (code XX))

## 現象

```java:java
        String jsonString
                = "{\n"
                + "    \"data\": [\n"
                + "        {\n"
                + "            \"id\": 1,\n"
                + "            \"name\": \"山田太郎\",\n"
                + "        },\n"
                + "        {\n"
                + "            \"id\": 2,\n"
                + "            \"name\": \"山田次郎\",\n"
                + "        },\n"
                + "    ],\n"
                + "    \"success\": true\n"
                + "}";

        Map<String, Object> jsonMap = objectMapper.readValue(jsonString, new TypeReference<Map<String, Object>>(){});
```

```:エラーメッセージ
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)): was expecting double-quote to start field name
 at [Source: (String)"{
    "data": [
        {
            "id": 1,
            "name": "山田太郎",
        },
        {
            "id": 2,
            "name": "山田次郎",
        },
    ],
    "success": true
}"; line: 6, column: 10]
	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:2477)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:750)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:674)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddName(ReaderBasedJsonParser.java:1940)
	at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextFieldName(ReaderBasedJsonParser.java:968)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializerNR._deserializeNR(UntypedObjectDeserializerNR.java:230)
	at com.fasterxml.jackson.databind.deser.std.UntypedObjectDeserializerNR.deserialize(UntypedObjectDeserializerNR.java:79)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap(MapDeserializer.java:623)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:449)
	at com.fasterxml.jackson.databind.deser.std.MapDeserializer.deserialize(MapDeserializer.java:32)
	at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4825)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3772)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3755)
	at com.example.demo.JacksonTest.test(JacksonTest.java:111)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
```

## 解決策
Json文字列内でオブジェクトや配列の末尾の要素の`,`を取り除く
```diff
        jsonString
                = "{\n"
                + "    \"data\": [\n"
                + "        {\n"
                + "            \"id\": 1,\n"
-               + "            \"name\": \"山田太郎\",\n"
+               + "            \"name\": \"山田太郎\"\n"
                + "        },\n"
                + "        {\n"
                + "            \"id\": 2,\n"
-               + "            \"name\": \"山田次郎\",\n"
-               + "        },\n"
+               + "            \"name\": \"山田次郎\"\n"
+               + "        }\n"
                + "    ],\n"
                + "    \"success\": true\n"
                + "}";
```