我尝试使用https://azure.microsoft.com/en-us/documentation/articles/documentdb-import-data/#Prerequisites将json文件上载到Azure DocumentDB。一旦上传得到了,我得到这个错误:Microsoft迁移数据库工具不正确的字符错误
System.ArgumentException: The resource name presented contains invalid character '/'. at Microsoft.Azure.Documents.Client.DocumentClient.ValidateResource(Resource resource) at Microsoft.Azure.Documents.Client.DocumentClient.d__33.MoveNext() --- End of stack trace from previous location where exception was thrown ---
我似乎无法找到这方面的文档,或者我不知道在哪里看。我希望得到一些关于这个意味着什么以及如何解决它的指导。我的猜测是“/”在我的文档中某处可能是无效字符,也许在第33行。
这是直到第33行的文档,如果这是它的含义。
[
{
"name":"Cabinet De Lespinasse",
"accountid":2953,
"address":null,
"city":null,
"country":null,
"createdAt":null,
"heading":null,
"headingid":null,
"latitude":null,
"longitude":null,
"objectId":null,
"phonenumber1":null,
"website":null,
"display":null,
"email":null,
"aboutUs":"Education: Graduated from the Faculty of Law, State University of Haiti, 1983, Types of Practice: Established in 1877, the law office is specialized in intellectual property law for trademark and patent, insurance and commercial matters. Does not handle collection, Languages: Creole, French, English",
"Verified":false,
"Brands":null,
"Products":null,
"Services":null,
"Facebook":null,
"Instagram":null,
"googlePlus":null,
"Twitter":null,
"LinkedIn":null,
"Youtube":null,
"Pinterest":null,
"paymentMethods":null,
"languagesSpoken":null
},
{//<--This is line 33//
"name":"Cabinet Villejoint",
"accountid":2952,
"address":null,
更新:
当我上传的格式如下一个对象,上传成功。我根据下面的@ larry评论删除了日期字段。
{
\t "name": "Western Union Agence Belmart ",
\t "accountid": 2851,
\t "address": "Route de Tabarre,",
\t "city": "Port-au-Prince",
\t "country": "Haiti",
\t "heading": "Money Transfer Locations",
\t "headingid": 428,
\t "latitude": null,
\t "longitude": null,
\t "objectId": "0NM7Bav1Lp",
\t "phonenumber1": "+509 3859 6346",
\t "website": "http://868.ht",
\t "display": "Western Union Agence Belmart",
\t "email": null,
\t "aboutUs": null,
\t "Verified": false,
\t "Brands": null,
\t "Products": null,
\t "Services": null,
\t "Facebook": null,
\t "Instagram": null,
\t "googlePlus": null,
\t "Twitter": null,
\t "LinkedIn": null,
\t "Youtube": null,
\t "Pinterest": null,
\t "paymentMethods": null,
\t "languagesSpoken": null
}
然而,当我有过以下的上传失败,第二个对象。任何想法发生了什么?
[{
"name":"Western Union Agence Belmart ",
"accountid":2851,
"address":"Route de Tabarre,",
"city":"Port-au-Prince",
"country":"Haiti",
"heading":"Money Transfer Locations",
"headingid":428,
"latitude":null,
"longitude":null,
"objectId":"0NM7Bav1Lp",
"phonenumber1":"+509 3859 6346",
"website":"http://868.ht",
"display":"Western Union Agence Belmart",
"email":null,
"aboutUs":null,
"Verified":false,
"Brands":null,
"Products":null,
"Services":null,
"Facebook":null,
"Instagram":null,
"googlePlus":null,
"Twitter":null,
"LinkedIn":null,
"Youtube":null,
"Pinterest":null,
"paymentMethods":null,
"languagesSpoken":null
},
{
"name":"Western Union Agence Belmart ",
"accountid":2853,
"address":"Route de Tabarre,",
"city":"Port-au-Prince",
"country":"Haiti",
"heading":"Money Transfer Locations",
"headingid":428,
"latitude":null,
"longitude":null,
"objectId":"0NM7Bav1Lp",
"phonenumber1":"+509 3859 6346",
"website":"http://868.ht",
"display":"Western Union Agence Belmart",
"email":null,
"aboutUs":null,
"Verified":false,
"Brands":null,
"Products":null,
"Services":null,
"Facebook":null,
"Instagram":null,
"googlePlus":null,
"Twitter":null,
"LinkedIn":null,
"Youtube":null,
"Pinterest":null,
"paymentMethods":null,
"languagesSpoken":null
}]
谢谢。
注释'// < - 这是第33行//实际上是在JSON中吗? JSON不支持评论。 –
这不是在JSON中。 json中没有评论。我只是指出33号线的最佳办法。我想你的问题指引我看看是否有关于Azure DocumentDB接受的格式的细节。我会寻找任何“/”开始... – idkjs
你可以尝试通过http://jsonlint.com运行你的JSON。如果它通过但未被数据迁移工具所接受,那么数据迁移工具中可能存在一个错误,因为我发现DocumentDB接受所有正确的JSON,但没有JSON扩展。对于一些JavaScript Date()对象不被接受的情况尤其令人沮丧。 –