Search code examples
c#mysqlunpackblobs

Library unpacking MySQL BLOBS in c#


I have some BLOBS column in a MySQL database. I want to unpack, read it and the save unpacked data into another table.

Is there a library for unpacking MySQL BLOBS in c#? I have tried using code but was wondering if there was any free library for the same.


Solution

  • Hi you can use MessagePack library for unpacking the blob data into json format.

     byte[] test = (Byte[])reader[0];
        Console.WriteLine("============================RAW===========================================");                            
        string text = System.Text.UnicodeEncoding.UTF8.GetString(test);
        Console.WriteLine(text);
        Console.WriteLine("============================UNPACKED======================================");
        var json = MessagePackSerializer.ToJson(test);