Interesting. Are you sure it’s the array that JsonUtility is having trouble with or is it the generic object? You’re actually deserializing a generic object with an array of T. Maybe the built in JsonUtility doesn’t support generic objects. I’m not very familiar with it but I know it’s very limited in its serialization and deserialization capabilities. I don’t see any issues with your json string itself.
Edit, as an aside, instead of wrapping your Json string in JsonDotNet, you could also do:
var wrapper = new Wrapper<ArrayType>();
wrapper.Items = JsonConvert.DeserializeObject<ArrayType>(json);
You could do the same with the JsonUtility. You could actually even expand your Wrapper class with a static method like so:
public static Wrapper<T> FromJson(json)
{
return new Wrapper<T> { Items = JsonConvert.DeserializeObject<T>(json) };
}
Then you wouldn’t lose your dynamic utility method approach. Of course here, T would be an array type rather than a base item type.
JsonUtility supports generic object as long as it’s [System.Serializable]. The issue may relate to top-level array, since I found this How to load an array with JsonUtility? - Unity Engine - Unity Discussions .
Your asset works great, I’ve been used it for years, and now it seems will be even longer
Thanks! I wasn’t trying to persuade you otherwise. The JsonUtility is native and certainly the fastest and most gc friendly solution when it works! It’s just far more limited.