Base64编码的WAV从JSON对象提取问题,怎么解决

2024-11-01 01:38:51
推荐回答(1个)
回答(1):

WebClient client = new WebClient();
Stream stream = client.OpenRead("http://waps.repli-con.com/services/ivrservices/getUserNameRecording/10000");
StreamReader reader = new StreamReader(stream);

JToken token = JObject.Parse(reader.ReadToEnd().ToString());

string base64string = token.SelectToken("result").SelectToken("value").ToString();
Byte[] b = Convert.FromBase64String(base64string);
System.IO.File.WriteAllBytes(@"C:\Users\user\Desktop\test.wav", b);
stream.Close();