title: Extract Base64 encoded WAV from JSON object
body: <p>Creating a .Net 3.5 assembly that is making a call to PHP server. Return value a JSON object. The JSON object has a Base64 encoded WAV file (see below). Trying to use Newtonsoft.Json to get the WAV converted from "value". Spent 8 hours trying...</p>
  
  <p>here is the code I have tried</p>
  
  <pre><code>int count = 0;
  byte[] buf = new byte[8192];
  HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
  HttpWebResponse response = (HttpWebResponse)request.GetResponse();
  Stream resStream = response.GetResponseStream();
  count = resStream.Read(buf, 0, buf.Length);
  string json = Encoding.ASCII.GetString(buf, 0, count);
  
  JObject jo = JObject.Parse(json);
  //JObject jo = (JObject)JsonConvert.DeserializeObject(json);
  </code></pre>
  
  <p>This is where I get stuck. Error reads:</p>
  
  <p><strong><em>"Unterminated string. Expected delimiter: \". Path 'result.value', line 1, position 3449."</em></strong></p>
  
  <p>Almost like the string is too long...</p>
  
  <p>Have not even gotten to the Base64 convert code I sourced off the internet that needs to be tweaked</p>
  
  <pre><code>char[] base64CharArray;
  inFile = new System.IO.StreamReader(inputFileName,System.Text.Encoding.ASCII);
  base64CharArray = new char[inFile.BaseStream.Length];
  inFile.Read(base64CharArray, 0, (int)inFile.BaseStream.Length);
  base64String = new string(base64CharArray);
  </code></pre>
  
  <p>Solution is to go live first thing Monday... </p>