I'm trying to create a json file from c#. I need to remove this array, "judgmentLinkedAccount": [], if it's empty. I tried:
public static void ReplaceText()
{
string text = File.ReadAllText(FileToExport.exportFile);
string textToReplace = "\"" + "judgmentLinkedAccount" + "\"" + ": []";
text = text.Replace(textToReplace, "");
File.WriteAllText(FileToExport.exportFile, text);
}
But it doesn't remove the text. Thanks for any help.