【问题标题】:JSON error I can't fix?? (Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined')JSON错误我无法修复?? (期望 'STRING'、'NUMBER'、'NULL'、'TRUE'、'FALSE'、'{'、'[',得到 'undefined')
【发布时间】:2016-09-11 11:42:20
【问题描述】:

我收到以下错误,我不知道如何解决它:

块引用 错误:第 1660 行的解析错误: ...,“描述”:“心理咨询师 ----------------------^ 期待 'STRING'、'NUMBER'、'NULL'、'TRUE'、'FALSE'、'{'、'[',得到 'undefined'

这是引发此错误的文件部分:

{
        "ItemNum": "289",
        "ItemStartDate": "01.07.2008",
        "Category": "1",
        "Group": "A8",
        "ItemType": "S",
        "FeeType": "N",
        "NewItem": "N",
        "ItemChange": "N",
        "AnaesChange": "N",
        "DescriptorChange": "N",
        "FeeChange": "N",
        "EMSNChange": "N",
        "EMSNCap": "P",
        "BenefitType": "C",
        "BenefitStartDate": "01.07.2008",
        "FeeStartDate": "01.11.2012",
        "ScheduleFee": "263.90",
        "Benefit75": "197.95",
        "Benefit85": "224.35",
        "EMSNStartDate": "01.11.2012",
        "EMSNMaximumCap": "500.00",
        "EMSNPercentageCap": "300.00",
        "DescriptionStartDate": "01.11.2011",
        "Description": "consultant psychiatrist, referred consultation for assessment, diagnosis and development of a treatment and management plan for autism or any other pervasive developmental disorder - surgery or hospital professional attendance of at least 45 minutes duration, at consulting rooms or hospital, by a consultant physician in his or her specialty of psychiatry, for assessment, diagnosis and the preparation of a treatment and management plan for a child aged under 13 years, with autism or any other pervasive developmental disorder, who has been referred to the consultant psychiatrist by a referring practitioner, if the consultant psychiatrist does the following:(a) undertakes a comprehensive assessment of the child and forms a diagnosis (using the assistance of one or more  allied health providers where appropriate)(b) develops a treatment and management plan which must include the following: (i) the outcomes of the assessment; (ii) the diagnosis or diagnoses; (iii) opinion on risk assessment; (iv) treatment options and decisions; (v) appropriate medication recommendations, where necessary.(c) provides a copy of the treatment and management plan to the: (i) referring practitioner; and (ii) relevant allied health providers (where appropriate).not being an attendance on a child in respect of whom payment has previously been made under this item or items 135, 137 or 139."
    },

我做错了什么?

【问题讨论】:

  • 我认为错误必须在文件的不同部分,因为它表明存在单词undefined(未引用),可能是某个地方给DescriptionStartDate的值。尝试找到... undefined 不允许作为 JSON 中的值,但是 null 是,所以也许替换它。

标签: json


【解决方案1】:

去掉 , 最后使用 http://jsonviewer.stack.hu/ 验证它是否有效

【讨论】:

    【解决方案2】:

    此错误是由于我们在 JSON 中使用的引号引起的。也许您在 JSON 中使用了“而不是”。为了解决此错误,您必须将所有“引号”替换为“。请找到您的 JSON 的验证检查结果如下

    【讨论】:

    • 请尽可能分享代码而不是图片。
    【解决方案3】:

    我有一些问题。现在如果你运行 composer -vvv update 你得到

    Reading composer.json of git@bitbucket.org:test/test.git (master)
        Executing command (C:/Users/xxx/AppData/Local/Composer/vcs/git-test/test.git/): git show "72721b472adb50643e9bfd1745544db3522b58d2":"compoSkipped branch master, "72721b472adb50643e9bfd1745544db3522b58d2:composer.json" does not contain valid JSON
        Parse error on line 1:
        C:\Users\xxx\AppD
        ^
        Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
    

    从详细模式你可以看到 git 正在从

    获取 json
     git show "72721b472adb50643e9bfd1745544db3522b58d2":"compoSkipped branch master, "72721b472adb50643e9bfd1745544db3522b58d2:composer.json"
    

    问题出在您运行作曲家的控制台编码中。就我而言,我在 CP-1250 中有控制台编码。当我将控制台编码更改为 ANSI 时,它可以正常工作。

    【讨论】:

      【解决方案4】:
      {
          "ItemNum": "289",
          "ItemStartDate": "01.07.2008",
          "Category": "1",
          "Group": "A8",
          "ItemType": "S",
          "FeeType": "N",
          "NewItem": "N",
          "ItemChange": "N",
          "AnaesChange": "N",
          "DescriptorChange": "N",
          "FeeChange": "N",
          "EMSNChange": "N",
          "EMSNCap": "P",
          "BenefitType": "C",
          "BenefitStartDate": "01.07.2008",
          "FeeStartDate": "01.11.2012",
          "ScheduleFee": "263.90",
          "Benefit75": "197.95",
          "Benefit85": "224.35",
          "EMSNStartDate": "01.11.2012",
          "EMSNMaximumCap": "500.00",
          "EMSNPercentageCap": "300.00",
          "DescriptionStartDate": "01.11.2011",
          "Description": "consultant psychiatrist, referred consultation for assessment, diagnosis and development of a treatment and management plan for autism or any other pervasive developmental disorder - surgery or hospital professional attendance of at least 45 minutes duration, at consulting rooms or hospital, by a consultant physician in his or her specialty of psychiatry, for assessment, diagnosis and the preparation of a treatment and management plan for a child aged under 13 years, with autism or any other pervasive developmental disorder, who has been referred to the consultant psychiatrist by a referring practitioner, if the consultant psychiatrist does the following:(a) undertakes a comprehensive assessment of the child and forms a diagnosis (using the assistance of one or more  allied health providers where appropriate)(b) develops a treatment and management plan which must include the following: (i) the outcomes of the assessment; (ii) the diagnosis or diagnoses; (iii) opinion on risk assessment; (iv) treatment options and decisions; (v) appropriate medication recommendations, where necessary.(c) provides a copy of the treatment and management plan to the: (i) referring practitioner; and (ii) relevant allied health providers (where appropriate).not being an attendance on a child in respect of whom payment has previously been made under this item or items 135, 137 or 139."
      }
      

      结果:

      将编译为有效 JSON

      最后去掉逗号

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多