PackUtils/JsonUtility.cs
/// <summary>
/// add a "container" to avoid array at json root
/// </summary>
/// <param name="json"></param>
/// <param name="property"></param>
/// <returns></returns>
add a "container" to avoid array at json root
add a " container " to avoid array at json root
public static string AvoidArray(this string json, string property)
        {
            var isArray = json.Trim().Trim('\t').StartsWith("[");
            if (isArray)
            {
                json = "{ \"" + property + "\" : " + json + " }";
            }
            return json;
        }
public static string AvoidArray ( this string json , string property ) { var isArray = json . Trim ( ) . Trim ( ' \t ' ) . StartsWith ( " " ) ; if ( isArray ) { json = " \" " + property + " \" " + json + " " ; } return json ; }
add a "container" to avoid array at json root
add a " container " to avoid array at json root
None
string
this
property
string
None
json
None