Json String To Byte Array
using System;
using System.IO;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Imaging;
public static class Tool
{
public static byte[] JsonStringToByteArray(string jsonByteString)
{
jsonByteString = jsonByteString.Substring(1, jsonByteString.Length - 2);
string[] arr = jsonByteString.Split(',');
byte[] bResult = new byte[arr.Length];
for (int i = 0; i < arr.Length; i++)
{
bResult[i] = byte.Parse(arr[i]);
}
return bResult;
}
}
Related examples in the same category