Lord OfTheRing
Lord OfTheRing

Reputation: 1309

extract specific text from data

I have below text and I want to extract Comment allez-vous from below text how do I extract using C# ?. This text will be different all the time. rest of the data format is the same.

handleResponse({
 "data": {
  "translations": [
   {
    "translatedText": "Comment allez-vous"
   }
  ]
 }
}
);

Upvotes: 0

Views: 254

Answers (2)

Azodious
Azodious

Reputation: 13882

  1. Look for last index of ". index A

  2. Find first index for translatedText + length of translatedText +1. index B

  3. fetch all string betwee B and A.

Upvotes: 0

manojlds
manojlds

Reputation: 301527

It's JSON. Use a JSON parser for .Net like JSON.NET or the JavaScriptSerializer

Upvotes: 3

Related Questions