PackUtils/JsonUtility.cs
/// <summary>
/// Remove empty childrens from jtoken (when array)
/// </summary>
/// <param name="jtoken"></param>
/// <returns></returns>
Remove empty childrens from jtoken (when array)
Remove empty childrens from jtoken ( when array )
private static JToken RemoveEmptyChildrenFromArray(this JToken jtoken)
        {
            JArray copy = new JArray();
            foreach (JToken item in jtoken.Children())
            {
                var child = item;
                if (child.HasValues)
                {
                    child = child.RemoveEmptyChildren();
                }
                if (!child.IsEmpty())
                {
                    copy.Add(child);
                }
            }
            return copy;
        }
private static JToken RemoveEmptyChildrenFromArray ( this JToken jtoken ) { JArray copy = new JArray ( ) ; foreach ( JToken item in jtoken . Children ( ) ) { var child = item ; if ( child . HasValues ) { child = child . RemoveEmptyChildren ( ) ; } if ( ! child . IsEmpty ( ) ) { copy . Add ( child ) ; } } return copy ; }
Remove empty childrens from jtoken (when array)
Remove empty childrens from jtoken ( when array )
None
JToken
this
jtoken
None