A .NET Core Library for converting Bencoded Dictionaries to Json Documents
Bencoded dictionaries like the one shown below can easily be coverted to JSON using this library.
d5:debug4:truee
{
"debug": "true"
}
Install the package Bencode2Json from NuGet or install it from the Package Manager Console:
PM> Install-Package Bencode2Json
using Bencode2Json;
...
...
// BencodedData takes any Stream
var bencodedData = new BencodedData(dataStream);
var json = bencodedData.ConvertToJson();
Demos in the Examples folder.
This demo parses an torrent file (which is basically a bencoded dictionary) and converts it to JSON. This JSON is then passed to the popular JSON library JSON.NET for converting it into C# objects.