Reputation: 31
I have a string like this:
{"label":{"en":"Africa","de":"Afrika"},"description":{"en":"continent","de":"irdischer Kontinent"}}
Is possible convert to list like:
"label" - "en":"Africa","de":"Afrika"
"description" - "en":"continent","de":"irdischer Kontinent"
Thanks
Upvotes: 3
Views: 193
Reputation: 149020
As others have suggested, it looks like you're trying to process a JSON document. I recommend Json.NET for this.
However, you can manipulate your string by itself if the transformation is very simple and you don't expect much variation in your input. One easy way would be to do something like this:
var result = input.Replace(":{", " - ")
.Replace("},", Environment.NewLine)
.Replace("{", string.Empty)
.Replace("}", string.Empty);
Upvotes: 3