GSON MalformedJsonException 错误消息中的路径是什么?

What is path in GSON MalformedJsonException error message?

如果 GSON 库不喜欢它被要求解析的 JSON,它会抛出类似此错误消息的异常:

com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 8 path $

path $ 是什么意思?我在 javadocs 中找不到任何参考资料。

JsonReader constructs a MalformedJsonException using JsonPath, see code here.

getPath() 的 Javadoc(用于获取 JSON 路径)指出

Returns a JsonPath to the current location in the JSON value.

JSONPath 是一个导航工具 JSON 并定义路径 $.

Since a JSON structure is usually anonymous and doesn't necessarily have a "root member object" JSONPath assumes the abstract name $ assigned to the outer level object.

本质上是根对象、数组或其他 JSON 值。