Given an example json object like:
{
"Id": 1,
"Name": "Pablo",
"UnwantedProperty1XOXO": true,
"UnwantedProperty2XOXO": false,
...
}
I want to remove every property that ends in XOXO (so the regex would be something like /.+XOXO$).
How can I remove all the properties with names that match a regular expression with PowerShell? (either with a JSON object or PowerShell object)
I can remove properties from a PowerShell object like this but it doesn't seem to work with a regular expressions:
$myObject.PSObject.Properties.Remove("someProperty")