View
我在解析 JSON 文件的方法中有以下代码。该方法以整数形式ContentsOfDictionary
接受参数d
,Xojo.Core.Dictionary
并返回文本。如果我在操作按钮中使用,我会收到此错误:level
ContentsOfDictionary
error: Not Enough arguments: got 0, expected at least 1
这是我正在使用的测试文件的链接。
我如何调用该方法ContentsOfDictionary
?
dim dict as Xojo.Core.Dictionary = Xojo.Data.ParseJSON (kJsonData)
const kEOL = &u0A
dim indent as text
for i as integer = 1 to level
indent = indent + " "
next
dim t as text
for each entry as Xojo.Core.DictionaryEntry in dict
t = t + indent + entry.Key + " "
if Xojo.Introspection.GetType( entry.Value ) is nil then
t = t + "nil" + kEOL
else
select case Xojo.Introspection.GetType( entry.Value ).Name
case "Boolean"
t = t + if( entry.Value, "true", "false" ) + kEOL
case "Text"
t = t + entry.Value + kEOL
case "Int32", "Int64"
//
// You get the idea
//
case "Dictionary"
t = t + kEOL + ContentsOfDictionary( entry.Value, level + 1 )
end select
end if
next
return t