You should not use ToObject to deserialize the array. Instead, you should use the Parse method to parse JSON.
When using ToObject you are assuming that you have an instance of an object in JSON that is deserialized (not an array or a scalar value), with Parse , it will handle any type that is serialized in JSON and return the corresponding type.
In this case, calling Parse and passing jsonResult to it will return an ArrayList that contains three instances:
ArrayList arrayList = fastJSON.JSON.Instance.parse(jsonResult) as ArrayList;
The problem is that now you have an ArrayList containing multiple Dictionary<string, object> instances that have scalar values (or other Dictionary<string, object> instances, in the case of references) associated with the property name.
I would call it a mistake. I expect the parsing of the array will be correct.
You can change the code for ParseArray to sniff the type when calling array.Add .
This still leaves a problem with ParseNumber (which could potentially be called), returning a string. This may or may not affect you.
I will make all the necessary changes and publish the problem with the problem tracker on the CodePlex project website .
casperOne
source share