Timeline for Passing variables into verbatim string literal for JSON request body
Current License: CC BY-SA 4.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 22, 2019 at 14:07 | vote | accept | cheslijones | ||
| Aug 13, 2019 at 20:46 | comment | added | fredrik |
If I remember correctly: ' is not valid in json to denote strings - only " is.
|
|
| Aug 13, 2019 at 20:44 | answer | added | Postlagerkarte | timeline score: 2 | |
| Aug 13, 2019 at 20:43 | comment | added | Jaydip Jadhav |
Why not try replace by placing some place holder like bodyJson.Replace("{0}","myvalue")
|
|
| Aug 13, 2019 at 20:42 | comment | added | Heretic Monkey |
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.
|
|
| Aug 13, 2019 at 20:40 | comment | added | user47589 | Please don't do this. Create an object and use a serializer! | |
| Aug 13, 2019 at 20:37 | history | edited | cheslijones | CC BY-SA 4.0 |
added 576 characters in body
|
| Aug 13, 2019 at 20:37 | comment | added | 001 |
You have to escape the { and }. How to escape braces (curly brackets) in a format string in .NET
|
|
| Aug 13, 2019 at 20:37 | comment | added | Ňɏssa Pøngjǣrdenlarp | JSON is serialized data from a model or object; rather than concocting a fancy string use a serializer | |
| Aug 13, 2019 at 20:33 | history | asked | cheslijones | CC BY-SA 4.0 |