JSON文件和CSV文件互转工具

JSON文件和CSV文件互转工具

工作需要,写了这么一个 JSON和CSV互转的小工具。

界面

JSON2CSV

源码

https://github.com/zrong/json2csv

JSON范例

 1{"widget": {
 2    "debug": "on",
 3    "window": {
 4        "title": "Sample Konfabulator Widget",
 5        "name": "main_window",
 6        "width": 500,
 7        "height": 500
 8    },
 9    "image": { 
10        "src": "Images/Sun.png",
11        "name": "sun1",
12        "hOffset": 250,
13        "vOffset": 250,
14        "alignment": "center"
15    },
16    "text": {
17        "data": "Click Here",
18        "size": 36,
19        "style": "bold",
20        "name": "text1",
21        "hOffset": 250,
22        "vOffset": 100,
23        "alignment": "center",
24        "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
25    }
26}}  

转换成的CSV

 1widget,text,onMouseUp,sun1.opacity = (sun1.opacity / 100) * 90;
 2widget,text,style,bold
 3widget,text,alignment,center
 4widget,text,name,text1
 5widget,text,data,Click Here
 6widget,image,name,sun1
 7widget,image,src,Images/Sun.png
 8widget,image,alignment,center
 9widget,debug,on,
10widget,window,name,main_window
11widget,window,title,Sample Konfabulator Widget