【问题标题】:Expecting 'EOF', '}', ':', ',', ']', got 'undefined'?期待'EOF'、'}'、':'、','、']',得到'未定义'?
【发布时间】:2018-10-26 15:23:01
【问题描述】:

我创建了自己的 JSON 文件,但出现以下错误 错误:第 4 行的解析错误: ...尼卡大学”'Freelance Android D ----------------------^ 期待 'EOF'、'}'、':'、','、']',得到 'undefined'

在我的json 结构下,我创建了自己的json api

{
        "Introduction": [{
            "image": "https://www.dropbox.com/s/1lxgp2xj8wtv3zk/10762650.jpg?dl=0qaC8sFGR/tA4zUizSJLwx+oamRxyLDuPAPc/4Un7thhg2evDYq0Sf/9k=FLMf",
            "introduction": "My name is Yodgorbek Komilov I have graduated  Bachelor of Computer Science at Riga Technical University"
            'Freelance Android Developer who loves to create Android apps and Google Android Developer scholarship recipient.'
            'Developed more than 10 android apps'

        }],
        "Education": [{
            "duration": "2012-2014",
            "institution": "Riga Technical University Latvia, Riga",
            "degree": "Bachelor Degree in Computer Science"
        }],
        "Work": [{
                "company": "Udacity",
                "duration": " Jun 2018 - Present ",
                "responsibility": "Android Project Reviewer"
            },
            {
                "company": "Mobi Verse",
                "duration": " Jan 2018 - Present",
                "responsibility": "Developing Android apps for US market"
            },
            {
                "company": "Freelancer",
                "duration": " Jan 2017 - Present",
                "responsibility": "Developing  eCommerce  and different various android apps"
            },
            {
                "company": "Softwerk AB",
                "duration": " December 2016 - May 2017",
                "responsibility": " Maintaining existing Android apps"
            }
        ],
        "Skills": [{
            "Programming": "Java, C Sharp, Kotlin, Swift",
            "Framework/Libraries": "Android, IOS",
            "Android Architecture Components": "Live Data, ViewModel, Room",
            "Software Methodologies": "Agile, Scrum, Waterfall",
            "IDE'S": "Eclipse, Android Studio, Xcode"
        }],
        "Contact": [{
            "Linkedin": "https://www.linkedin.com/in/edgar-sweden/",
            "gmail": "kyodgorbek@gmail.com",
            "phone number": "+46760981871"
        }]
}

【问题讨论】:

  • 您的 JSON 无效。你需要逃避你的报价。在你的价值观中使用\" 而不是"
  • mojej napisat 底漆
  • 我已经完成了,但仍然报错
  • @VladyslavMatviienko 它仍然报错
  • 哪一个?你改变了什么?

标签: android json


【解决方案1】:

您的 JSON 数据有错误。如果您需要多行字符串,请使用\n。所以你需要像这样设置introduction 字段:

"introduction": "My name is Yodgorbek Komilov I have graduated  Bachelor of Computer Science at Riga Technical University\nFreelance Android Developer who loves to create Android apps and Google Android Developer scholarship recipient.\nDeveloped more than 10 android apps"

并不是说我认为您不需要在该文本中使用单引号 '

【讨论】:

    【解决方案2】:

    您已经关闭了应该是连续的字符串。你可以使用下面的json。

    {
        "Introduction": [{
            "image": "https://www.dropbox.com/s/1lxgp2xj8wtv3zk/10762650.jpg?dl=0qaC8sFGR/tA4zUizSJLwx+oamRxyLDuPAPc/4Un7thhg2evDYq0Sf/9k=FLMf",
            "introduction": "My name is Yodgorbek Komilov I have graduated  Bachelor of Computer Science at Riga Technical University Freelance Android Developer who loves to create Android apps and Google Android Developer scholarship recipient. Developed more than 10 android apps."
        }],
        "Education":// your other code as it is
    }
    

    如果您不确定是否有足够的online services,请始终验证 json。

    【讨论】:

      【解决方案3】:
      "introduction": “My name is Yodgorbek Komilov I have graduated Bachelor of Computer Science at Riga Technical University Freelance Android Developer who loves to create Android apps and Google Android Developer scholarship recipient. Developed more than 10 android apps”
      }]
      

      因为您在 University 之后关闭了双引号,所以键 introduction 的值在那里结束。如果之后的所有内容都是另一个信息,那么您需要为此设置一个新密钥。

      【讨论】:

      • 我遇到了一个错误,请再次帮我更正
      猜你喜欢
      • 2021-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-18
      • 1970-01-01
      相关资源
      最近更新 更多