以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- JSON写法 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=144073) |
-- 作者:blackzhu -- 发布时间:2019/12/10 10:51:00 -- JSON写法 我有五个列: A列 = "org-manage",main-data": B列 = title": "百度","title": "腾讯",------- C列 = "icon": "",........ D列 = "title": "搜索"..... E列 = "href": "http://www.baidu.com/"......... 应该怎么写比较好? "org-manage": { "menu": [{ "title": "百度", "icon": "", "menu": [ { "title": "搜索", "href": "http://www.baidu.com/" }, { "title": "地图", "href": "http://map.baidu.com/" }, { "title": "贴吧", "href": "http://tieba.baidu.com/" } ] },{ "title": "腾讯", "icon": "", "menu": [ { "title": "微信", "href": "http://weixin.qq.com/" }, { "title": "QQ", "href": "http://vip.qq.com/?ADTAG=www.qq.com" }, { "title": "电脑管家", "href": "https://guanjia.qq.com/main.html?ADTAG=tr.pcmgr.qqcom.QQCOM" } ] },{ "title": "阿里巴巴", "icon": "", "menu": [ { "title": "天猫", "href": "https://www.tmall.com" }, { "title": "淘宝", "href": "https://www.taobao.com/" }, { "title": "阿里云", "href": "https://www.aliyun.com" } ] }
] }, "main-data": { "menu": [{ "title": "新闻", "icon": "", "menu": [ { "title": "网易", "href": "http://www.163.com/" }, { "title": "搜狐", "href": "http://www.sohu.com/" }, { "title": "凤凰新闻", "href": "http://www.ifeng.com/" } ] },{ "title": "视频", "icon": "", "menu": [ { "title": "优酷", "href": "http://youku.com/" }, { "title": "爱奇艺", "href": "http://www.iqiyi.com/" }, { "title": "百度视频", "href": "http://v.baidu.com/" } ] }] } |
-- 作者:有点蓝 -- 发布时间:2019/12/10 11:41:00 -- 把这个表格数据导出来 |
-- 作者:blackzhu -- 发布时间:2019/12/10 14:04:00 -- 好 |
-- 作者:有点蓝 -- 发布时间:2019/12/10 14:42:00 -- 貌似给的数据结构和json不太一样 Dim jo As New JObject Dim jo1,jo2 As JObject Dim ja,ja2 As JArray For Each s As String In DataTables("Sheet1").GetValues("oEnglishName","","序号") jo(s) = New JObject ja = new JArray For Each s1 As String In DataTables("Sheet1").GetValues("一级菜单","oEnglishName=\'" & s & "\'","序号") Dim dr As DataRow = DataTables("Sheet1").Find("oEnglishName=\'" & s & "\' and 一级菜单=\'" & s1 & "\'") jo1 = New JObject jo1("title") = s1 jo1("icon") = cstr(dr("icon")) ja2 = new JArray For Each s2 As String() In DataTables("Sheet1").GetValues("二级菜单|url","oEnglishName=\'" & s & "\' and 一级菜单=\'" & s1 & "\'") jo2 = New JObject jo2("title") = s2(0) jo2("href") = s2(1) ja2.add(jo2) jo1("menu") = ja2 Next ja.add(jo1) Next jo(s)("menu") = ja Next Output.Show(jo.ToString) |
-- 作者:blackzhu -- 发布时间:2019/12/10 15:17:00 -- 我看下 |