Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • 4
    JSON is serialized data from a model or object; rather than concocting a fancy string use a serializer Commented Aug 13, 2019 at 20:37
  • 2
    You have to escape the { and }. How to escape braces (curly brackets) in a format string in .NET Commented Aug 13, 2019 at 20:37
  • 2
    Please don't do this. Create an object and use a serializer! Commented Aug 13, 2019 at 20:40
  • You may want to consider using JObject to create the necessary structure and values rather than trying to escape and all that; for instance, technically you have invalid JSON because strings must use double quotes, not single quotes. Commented Aug 13, 2019 at 20:42
  • Why not try replace by placing some place holder like bodyJson.Replace("{0}","myvalue") Commented Aug 13, 2019 at 20:43