程序员总是需要在各种数据之间转换,如果您手上有一个表格文件,想转化为JSON并在代码中使用,或许这个JSON在线编辑器可以帮助您。
哈喽JSON在线编辑器不仅仅可以帮助您验证,压缩JSON,还可以帮您将JSON转化为其它的数据格式。比如JSON和CSV文件之间的互相转换。
下面以将北京市的邮政编码的JSON串,转化为CSV来进行说明。如下所示,是我们已经获得的北京市各区的邮政编码:
[
{
"100000": "100000",
"东城(Dongcheng)": "西城(Xicheng)"
},
{
"100000": "100000",
"东城(Dongcheng)": "崇文(Chongwen)"
},
{
"100000": "100000",
"东城(Dongcheng)": "宣武(Xuanwu)"
},
{
"100000": "100000",
"东城(Dongcheng)": "朝阳(Chaoyang)"
},
{
"100000": "100000",
"东城(Dongcheng)": "丰台(Fengtai)"
},
{
"100000": "100000",
"东城(Dongcheng)": "石景山(Shijingshan)"
},
{
"100000": "100000",
"东城(Dongcheng)": "海淀(Haidian)"
},
{
"100000": "102300",
"东城(Dongcheng)": "门头沟(Mentougou)"
},
{
"100000": "102400",
"东城(Dongcheng)": "房山(Fangshan)"
},
{
"100000": "101100",
"东城(Dongcheng)": "通州(Tongzhou)"
},
{
"100000": "101300",
"东城(Dongcheng)": "顺义(Shunyi)"
},
{
"100000": "102200",
"东城(Dongcheng)": "昌平(Changping)"
},
{
"100000": "102600",
"东城(Dongcheng)": "大兴(Daxing)"
},
{
"100000": "101400",
"东城(Dongcheng)": "怀柔(Huairou)"
},
{
"100000": "101200",
"东城(Dongcheng)": "平谷(Pinggu)"
},
{
"100000": "101500",
"东城(Dongcheng)": "密云(Miyun)"
},
{
"100000": "102100",
"东城(Dongcheng)": "延庆(Yanqing)"
}
]
整个转换过程很简单,如下图所示: