【问题标题】:Jackson JsonParseException:expected a valid valueJackson JsonParseException:期望一个有效值
【发布时间】:2017-03-28 00:56:21
【问题描述】:

我在将字符串解析为对象时遇到异常。能够 有人建议我,为什么我会收到这个错误?

 org.codehaus.jackson.JsonParseException: Unexpected character ('A' (code 65)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
     at [Source: java.io.StringReader@3f203f2; line: 1, column: 2]

仅供参考:我已经尝试过使用以下选项。但它不是 帮助。

_jsonMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES,true);

参考下面给出的JSONContent:

   {
    "date": 1468834383007,
    "seq": 2,
    "type": "CPT",
    "code": "31237",
    "bit": "Not Applicable",
    "desc": "Hello/world ; with chorme,\n\t\t\t\t\t\t\t\t\thelicopeer or one (two theree)",
    "qun": 2,
    "ty": "VS",
    "dstat": 1463682600000,
    "dend": 1463682600000,
    "prmInd": true,
    "deletable": false,
    "mar": false,
    "show": true,
    "uid": "10ab5ad8-a472-4be6-9e9d-a7c9589bb201",
    "compprcstr": "31237CPTNot hello/world,surgical;withbiopsy,one(two)2",
    "short": "NA",
    "tastsr": "CPT",
    "bui": false,
    "desFee": "Java\/oralceendo,\n\t\t\t\t\t\t\t\t\orlaceor two (f)",
    "pce": "31237",
    "desTrun": "Hello/java ,\n\t\t\t\t\t\t\t\t\Orlace or Java (three)",
    "sasStr": "Visit(s)",
    "codE": false,
    "fsDate": "05/20/2016",
    "feDate": "05/20/2016",
    "primary": false,
    "servTy": "VS",
    "doS": true,
    "proead": false,
    "ambulance": false,
    "lilatehell": "NA",
    "modifList": ["NA"],
    "prwithSeq": "31237CPT2",
    "dirty": true,
    "dirtySince": false,
    "entityName": "com.neopo.corba.model.hospital.Check",
    "skip1": false
}

谢谢。

【问题讨论】:

  • 你能发布json吗,从错误看来你没有添加正确的数据。请先验证您的 JSON。
  • 请编辑您的问题。截至目前,它缺乏格式以及您的代码。
  • 我猜你的 json 内容格式不正确
  • 首先,您的问题是格式化程序不正确。我尝试在 www.jsonlint.com 验证您的 JSON,但您的 JSON 格式有错误。 Error: Parse error on line 21: ...: false, "desFee": "Java\/oralceendo,\n ----------------------^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'你可以在那个网站上看到自己。
  • 仅使用在线 JSON 验证器,我注意到您在此行有一个错误:"desTrun": "Hello/java ,\n\t\t\t\t\t\t\t\t\Orlace or Java (three)",

标签: java json spring jackson


【解决方案1】:

json格式不正确

\t\O

改变

"desTrun": "Hello/java ,\n\t\t\t\t\t\t\t\t\Orlace or Java (three)",

 "desTrun": "Hello/java ,\n\t\t\t\t\t\t\t\t Orlace or Java (three)",

【讨论】:

    猜你喜欢
    • 2015-10-08
    • 1970-01-01
    • 2015-04-26
    • 2013-01-11
    • 2019-05-24
    • 2020-01-26
    • 1970-01-01
    • 2021-04-01
    • 2013-08-01
    相关资源
    最近更新 更多