PackUtils/JsonUtility.cs
/// <summary>
/// Rename all property found in jtoken and childrens
/// </summary>
/// <param name="jtoken"></param>
/// <param name="oldPropertyName"></param>
/// <param name="newPropertyName"></param>
/// <param name="handleValue"></param>
/// <returns></returns>
Rename all property found in jtoken and childrens
Rename all property found in jtoken and childrens
public static JToken RenameProperty(this JToken jtoken, string oldPropertyName, string newPropertyName, Func<JToken, JToken> handleValue)
        {
            if (string.IsNullOrWhiteSpace(oldPropertyName) == true)
            {
                throw new ArgumentNullException(nameof(oldPropertyName));
            }
            if (string.IsNullOrWhiteSpace(newPropertyName) == true)
            {
                throw new ArgumentNullException(nameof(newPropertyName));
            }
            if (jtoken == null)
            {
                return jtoken;
            }
            RenamePropertyFromJToken(jtoken, oldPropertyName, newPropertyName, handleValue);
            return jtoken;
        }
public static JToken RenameProperty ( this JToken jtoken , string oldPropertyName , string newPropertyName , Func < JToken , JToken > handleValue ) { if ( string . IsNullOrWhiteSpace ( oldPropertyName ) == true ) { throw new ArgumentNullException ( nameof ( oldPropertyName ) ) ; } if ( string . IsNullOrWhiteSpace ( newPropertyName ) == true ) { throw new ArgumentNullException ( nameof ( newPropertyName ) ) ; } if ( jtoken == null ) { return jtoken ; } RenamePropertyFromJToken ( jtoken , oldPropertyName , newPropertyName , handleValue ) ; return jtoken ; }
Rename all property found in jtoken and childrens
Rename all property found in jtoken and childrens
None
JToken
this
oldPropertyName
string
None
newPropertyName
string
None
handleValue
Func<JToken, JToken>
None
jtoken
None