Extracting a JSON object from a serialized string in C# -


assuming have string looks ...

string s = "{ \"id\": \"1\", \"name\" : \"test\" } has other text in same string"; 

is there way, in c#, extract json part of text own "token" when splitting string apart?

the goal simple. in string contains text, , possibly json object, wanted try , separate text json pass 1 off appropriate facility. there no deserialization needed, there no validation needed, , there no need turn json text object. wanted able pull text out.

bellow code should looking (i tested it):

string s = "{ \"id\": \"1\", something:{xx:22, yyy: \"3\"}, \"name\" : \"test\" } has other text in same string"; var regexp = new regex("([{].+[}])"); var match = regexp.match(s); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -