In my program, there is a string like this:
Lorem ipsum dolor sit amet, {CONSECTETUR} adipiscing elit. Cras mattis lacinia ex, non {GRAVIDA} quam malesuada in. Proin pretium tellus eu posuere ullamcorper. Suspendisse {SAGITTIS} ullamcorper pulvinar. Nam pharetra mi ut risus ornare dictum. Proin tortor nibh, euismod ac viverra sit amet, {SUSCIPIT} eget magna. Proin et feugiat neque, nec pellentesque magna. Duis {SOLLICITUDIN} ligula ac augue viverra, ac dignissim ipsum elementum. Nulla facilisi. Duis lacinia nec nisl sed ultrices. Morbi {VESTIBULUM} tortor vitae dui elementum pellentesque. Morbi egestas ultricies cursus. Pellentesque euismod consequat leo. Cras vitae sem non leo volutpat egestas. Morbi in leo eget sem lacinia finibus.
And a JSON file like this:
[
{
"Key": "{CONSECTETUR}",
"Value": "17/7/2018"
},
{
"Key": "{GRAVIDA}",
"Value": "21/7/2018"
},
{
"Key": "{SAGITTIS}",
"Value": "5/2/2020"
},
{
"Key": "{SUSCIPIT}",
"Value": "26/3/2020"
},
{
"Key": "{SOLLICITUDIN}",
"Value": "some value with lowecase"
},
{
"Key": "{VESTIBULUM}",
"Value": "6 years 3 months 17 days"
}
]
I want to replace keys with values. For this I can get keys and values with Newtonsoft Json.Net like this:
public class Info
{
public string Key { get; set; }
public string Value { get; set; }
}
var ls = JsonConvert.DeserializeObject<List<Info>>(PATH + "info.json"));
But I don't know how to complete the rest and how to replace the values in the json file with the keys in the string.