无法解析字符串API数据

时间:2018-09-15 17:55:18

标签: javascript json parsing dom github

我正在尝试访问从GitHub API返回的tags_url,但是由于typeof = string,我需要解析它才能访问它。我正在控制台中对此进行测试,并收到以下错误消息,但我不明白为什么。

//Returned data:
https://api.github.com/repos/open-guides/og-aws/tags
main.js:33 https://api.github.com/repos/aws/amazon-ecs-agent/tags
main.js:33 https://api.github.com/repos/mitchellh/goamz/tags
main.js:33 https://api.github.com/repos/aws/aws-cli/tags
main.js:33 https://api.github.com/repos/amazon-archives/amazon-cognito-identity-js/tags
main.js:33 https://api.github.com/repos/awslabs/amazon-kinesis-producer/tags
main.js:33 https://api.github.com/repos/waynehoover/s3_direct_upload/tags
main.js:33 https://api.github.com/repos/pyduan/amazonaccess/tags
main.js:33 https://api.github.com/repos/goamz/goamz/tags
main.js:33 https://api.github.com/repos/voldemort/voldemort/tags

console.log(JSON.parse(dataArr[0].tags_url));

VM1032:1 Uncaught SyntaxError: Unexpected token h in JSON at position 0
    at JSON.parse (<anonymous>)
    at <anonymous>:1:18

0 个答案:

没有答案