且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用Jackson&从json文件解析内容的问题消息-JsonMappingException-无法从START_ARRAY令牌中反序列化

更新时间:2022-02-13 22:44:18

您的JSON字符串格式不正确:center的类型是无效对象的数组.在longitudelatitude周围的JSON字符串中将[]替换为{},这样它们将成为对象:

Your JSON string is malformed: the type of center is an array of invalid objects. Replace [ and ] with { and } in the JSON string around longitude and latitude so they will be objects:

[
    {
        "name" : "New York",
        "number" : "732921",
        "center" : {
                "latitude" : 38.895111, 
                "longitude" : -77.036667
            }
    },
    {
        "name" : "San Francisco",
        "number" : "298732",
        "center" : {
                "latitude" : 37.783333, 
                "longitude" : -122.416667
            }
    }
]