小编kon*_*hul的帖子

“无法识别的标记 'com':期待('true'、'false' 或 'null')”

我已将此 json 转换为字符串以保存在本地数据库中

{
        "type": "file",
        "id": "b665ff0b-5f7b-4991-ae88-ac5054880223",
        "link": {
            "href": "https://s3-eu-west-com/87e9edff-e7bd-49ea-aa7a-8948cac29bc1/b665ff0b-5f7b-4991-ae88-ac5054880223.jpg"
        },
        "file_name": "sony 431.jpg",
        "mime_type": "image/jpeg",
        "file_size": 66727,
        "public": true,
        "meta": {
            "dimensions": {
                "width": 1500,
                "height": 1500
            },
            "timestamps": {
                "created_at": "2018-01-22T11:07:35.527Z"
            }
        },
        "links": {
            "current": "https://api.e-com.com/v2/files/b665ff0b-5f7b-4991-ae88-ac5054880223"
        }
    }
Run Code Online (Sandbox Code Playgroud)

当我通过转换为 JSON 来使用该字符串时,我收到错误消息

“无法识别的标记 'com':期待('true'、'false' 或 'null')”

我该如何解决该错误?

这就是我将这个 json 转换为字符串的方式:

staticFile1.setFile(file.toString());
Run Code Online (Sandbox Code Playgroud)

和字符串到json:

File file1 = new ObjectMapper().readValue(file, File.class);
Run Code Online (Sandbox Code Playgroud)

java android json string-conversion jsonexception

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

java ×1

json ×1

jsonexception ×1

string-conversion ×1