为什么这个字典包含这么多#undefs?如何忽略它们?

Why does this Dict contain so many #undefs? How to ignore them?

使用 Julia,我试图读取和解释 JSON 数据,但我得到了很多 #undef。如何获取不包含undefs的数组?

using JSON
source = "http://api.herostats.io/heroes/1"
download(source, "1.json")
hdict  = JSON.parsefile("1.json")

#Why does hdict have so many #undefs?
hdict.vals
hdict.keys
#And how to remove them?

如果您不小心,Julia 有时会让您做一些傻事。在这种情况下,您将通过访问 hdict.keyshdict.vals 并访问包含项目的底层数组来查看字典的内部结构(哈希映射)。

尝试:

values(hdict)
keys(hdict)