curl GET json 文件:输出文件具有其他字符串'text'和特殊字符,如''



也许有人能支持我提出curl请求吗?我调用Bitbucket(v1.0(的RESTneneneba API,通过curl传输获得一个json文件。通话内容如下:

curl -k -s -X GET -H "Authorization: Bearer xyxyxyz" -H "Content-Type: application/json" 
"https://code.somecompany.corp/bitbucket/rest/api"/1.0/projects/<projectname>/repos/davinci-reviewer-list/browse/mapfile.json --output mapfile.json

输出应该与mapfile.json:的原始内容完全相同

{
"repos": [
{
"reponame": "account-opening-svc",
"rev_list": "BE"
},
{
"reponame": "alertmanager-config",
"rev_list": "DEVOPS"
},
{
"reponame": "antivirus-lambda",
"rev_list": "BE"
}
]
}

但是,当我打开或cat mapfile.json时,字符串"text"和字符串"lines"已添加到每一行以及特殊字符中:

{
"lines": [
{
"text": "{"
},
{
"text": "  "repos": ["
},
{
"text": "    {"
},
{
"text": "      "reponame": "account-opening-svc","
},
{
"text": "      "rev_list": "BE""
},
{
"text": "    },"
},
{
"text": "    {"
},
{
"text": "      "reponame": "alertmanager-config","
},
{
"text": "      "rev_list": "DEVOPS""
},
{
"text": "    },"
},
{
"text": "    {"
},
{
"text": "      "reponame": "antivirus-lambda","
},
{
"text": "      "rev_list": "BE""
},
{
"text": "    },"
}...
],
"start": 0,
"size": 340,
"isLastPage": true
}

如何只获取原始json内容?非常感谢!!!

问题解决了-url只指向Bitbucket的api,但需要指向原始数据的链接。在我的情况下,它看起来像:

/rest/api/1.0/projects/<projectname>/repos/reviewer-list/raw/mapfile.json?at=refs%2Fheads%2Fmaster

最新更新