I get a System.Format exception when trying this:
var jsonString = String.Format( @"{
""searchOptions"": {
""departurePosition"": { ""id"": {0} },
""arrivalPosition"": { ""id"": 376422 },
""travelModes"": [ ""Flight"", ""Train"", ""Bus"" ],
""departureDate"": ""2017-01-15"",
""passengers"": [
{
""age"": 12,
""discountCards"": [ ]
}
],
""userInfo"": {
""identifier"": ""0.jhvlf8amtgk"",
""domain"": "".com"",
""locale"": ""en"",
""currency"": ""EUR""
},
""abTestParameters"": [ ]
}
}", departurePosition);
I need this when sending a post request to a server.
How can I solve this problem ?
var json = Newtonsoft.Json.JsonConvert.SerializeObject(yourDataInstance)to create a json string.