I have a JSON:
{
\"scbs_currentstatus\": \"\",
\"scbs_primaryissue\": \"\",
\"_umb_id\": \"Test\",
\"_umb_creator\": \"Admin\",
\
You can parse the string first:
var temp = JArray.Parse(json);
temp.Descendants()
.OfType()
.Where(attr => attr.Name.StartsWith("_umb_"))
.ToList() // you should call ToList because you're about to changing the result, which is not possible if it is IEnumerable
.ForEach(attr => attr.Remove()); // removing unwanted attributes
json = temp.ToString(); // backing result to json
UPDATE OR:
result.Properties()
.Where(attr => attr.Name.StartsWith("_umb_"))
.ToList()
.ForEach(attr => attr.Remove());
UPDATE #2
You can specify more conditions in where
clause:
.Where(attr => attr.Name.StartsWith("_umb_") && some_other_condition)
OR
.Where(attr => attr.Name.StartsWith("_umb_") || some_other_condition)
Or whatever you need.