关于Unity读取JSON的坑

最近在做项目的时候发现读取Json的过程过出现了这么一个问题:

KeyNotFoundException: The given key was not present in the dictionary. System.Collections.Generic.Dictionary`2[System.Int32,System.Int32[]].get_Item (Int32 key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Diction关于Unity读取JSON的坑

反复看了代码都没有发现错误,最后才知道是Text文档的错误,如果你在excel写完数据 在网上转换成Json格式导入的话,最后一行的逗号是没有去掉的,一定要记得去掉最后一行的逗号!