I am having issue with String.Format on a verbatim string with escaped curly braced.
It's raising a FormatError() Exception:Message: System.FormatException : Input string was not in a correct format.
String s = $@"{{ ""ver"": ""1.0"",""userId"": ""{0}""}}";
String.Format(s, "1234")
You are using the C# string interpolation special character "$", however, you are using positional parameters in your template.
It should be:-
Or just:-
If your intention is to generate JSON output, a more appropriate method would be to create your object and serialize it using the
Newtonsoft.Jsonpackage:-