Parse byte array to json with Json.Net

Is the byte[] some sort of encoded text? If so, decode it first, e.g. if the encoding is UTF8:

public static Dictionary<String, Object> parse(byte[] json){
     string jsonStr = Encoding.UTF8.GetString(json);
     return JsonConvert.DeserializeObject<Dictionary<String, Object>>(jsonStr);
}

Leave a Comment