using System; using UnityEngine; public static class JsonUtilityArrays { public static T[] FromJson(string json) { Wrapper wrapper = JsonUtility.FromJson>(json); return wrapper.Items; } public static string ToJson(T[] array) { Wrapper wrapper = new Wrapper(); wrapper.Items = array; return JsonUtility.ToJson(wrapper); } public static string ToJson(T[] array, bool prettyPrint) { Wrapper wrapper = new Wrapper(); wrapper.Items = array; return JsonUtility.ToJson(wrapper, prettyPrint); } [Serializable] private class Wrapper { public T[] Items; } }