c# - Need help replacing parts of json string with regex -


how can replace following using regex.replace in c# application?

replace of following:

rendition\":{ 

with:

rendition\":[{ 

so adding left square bracket.

and also

replace:

\"}} 

with:

\"}]} 

i using jsonconvert newtonsoft convert xml json. rendition element in xmls may or may not array. trying force converted json array

replace:

(?<=rendition:)\"\{(.*?)\"\}\} 

with:

\"[{$1\"}]} 

in c#:

string json2 = regex.replace(json, "(?<=rendition\\\\\":)\\{(.*?)\\}\\}", "[{$1}]}"); 

see live demo of c# code running on ideone.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -