【发布时间】:2015-09-19 01:17:16
【问题描述】:
我正在关注 raywenderlich.com 上的热门教程来预加载核心数据。 这是我的 JSON 文件:
[
{
"countDescription": "###",
"countId": "###",
"states": [
{
"stateDesc": "###",
"stateId": "###",
"cities": [
{
"cityDescription": "###",
"cityId": "###",
"destinations": [
{
"destDescription": "###",
"destId": "###"
},
{
"destDescription": "###",
"destId": "###"
}
]
},
{
"cityDescription": "###",
"cityId": "###",
"destinations": [
{
"destDescription": "###",
"destId": "###"
},
{
"destDescription": "###",
"destId": "###"
}
]
}
]
},
{
"stateDesc": "###",
"stateId": "###",
"cities": [
{
"cityDescription": "###",
"cityId": "###",
"destinations": [
{
"destDescription": "###",
"destId": "###"
},
{
"destDescription": "###",
"destId": "###"
}
]
}
]
}
]
},
{
"countDescription": "###",
"countId": "###",
"states": [
{
"stateDesc": "###",
"stateId": "###",
"cities": [
{
"cityDescription": "###",
"cityId": "###",
"destinations": [
{
"destDescription": "###",
"destId": "###"
}
]
}
]
}
]
}
]
我的问题是如何在 excel 中执行此操作,然后我可以将其保存为 CSV 文件并使用 converter 获取我的 JSON。
在转换器网站中,我使用了 JSON-to-CSV 选项,但生成的 CSV 文件只为我提供实体 Country 的列,然后每一行的其他所有内容都在下一列中,其他属性的名称消失。
如果我使用另一个 source 那就太好了,它看起来就像我想的那样:
"countDescription","countId","states__stateDesc","states__stateId","states__cities__cityDescription","states__cities__cityId","states__cities__destinations__destDescription","states__cities__destinations__destId"
"###","###","###","###","###","###","###","###"
"","","","","","","###","###"
"","","","","###","###","###","###"
"","","","","","","###","###"
"","","###","###","###","###","###","###"
"","","","","","","###","###"
"###","###","###","###","###","###","###","###"
但是,一旦我对表格进行了更改,然后继续将其保存为 CSV 文件,格式就不同了,这是什么原因?
英语是我的第二语言,我希望我的问题不是太难理解,如果你们不介意我问,一对多对一对多对一是否正确-数据模型的多对多?我确实设法将 JSON 文件预加载到核心数据中。
【问题讨论】: