Closed Coder3333 closed 1 year ago
Just load/parse your json into a Newtonsoft.Json.Linq.JToken representation and then write the JToken back to a file/TextWriter or get the json string from it. JToken and its derived types JObject/JArray/etc... ignore json comments (unless explicitly told otherwise), so this seems to be the quickest way to achieve what you want with the least amount of effort.
(Please close this issue if this resolves your problem. If my suggestion does not resolve your issue, i would recommend to ask on stackoverflow.com instead.)
@elgonzo , thank you for the tip. I don't know how this solution didn't show up in my online searches, which included stackoverflow.
This may be a feature request. I cannot find a way to easily remove comments from a json string. Is this a feature of Newtonsoft.Json or could it be added?