Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]如何判断JToken的类型?

1楼
zyl19810322 发表于:2024/9/13 11:46:00
Dim json As String = "{""name"":""John Doe"",""age"":30,""isEmployed"":true,""skills"":[""C#"",""VB.NET"",""SQL""],""address"":{""street"":""123 Main St"",""city"":""Anytown"",""zip"":""12345""}}"
Dim jo As JObject = JObject.Parse(json)
For Each it As JToken In jo.Children 
        Output.Show(it.Type)
Next
以上代码输出全部为4,明明有JTokenType.Object,JTokenType.Array,JTokenType.Property
2楼
有点蓝 发表于:2024/9/13 12:02:00
Dim json As String = "{""name"":""John Doe"",""age"":30,""isEmployed"":true,""skills"":[""C#"",""VB.NET"",""SQL""],""address"":{""street"":""123 Main St"",""city"":""Anytown"",""zip"":""12345""}}"
Dim jo As JObject = JObject.Parse(json)
For Each it As Object In jo 
    Output.Show(it.value.Type)
Next

For Each item As JTokenType In [Enum].GetValues(GetType(JTokenType))
    Output.Show(item & "-" & item.Tostring())
Next
3楼
zyl19810322 发表于:2024/9/13 12:06:00
谢谢

共3 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.