https://github.com/vijayshinva/bencode2json
A .NET Core Library for converting Bencoded Dictionaries to Json Documents
https://github.com/vijayshinva/bencode2json
bencode bencode-parser dotnet-core json torrent torrent-files
Last synced: about 1 month ago
JSON representation
A .NET Core Library for converting Bencoded Dictionaries to Json Documents
- Host: GitHub
- URL: https://github.com/vijayshinva/bencode2json
- Owner: vijayshinva
- License: mit
- Created: 2017-08-17T15:26:32.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T18:35:26.000Z (over 2 years ago)
- Last Synced: 2025-04-10T22:54:09.343Z (about 1 month ago)
- Topics: bencode, bencode-parser, dotnet-core, json, torrent, torrent-files
- Language: C#
- Homepage:
- Size: 78.1 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bencode2Json
A .NET Core Library for converting Bencoded Dictionaries to Json Documents
[](https://ci.appveyor.com/project/vijayshinva/bencode2json/branch/master)
[](https://www.codefactor.io/repository/github/vijayshinva/bencode2json)
[](https://badge.fury.io/nu/bencode2json)## Overview
Bencoded dictionaries like the one shown below can easily be coverted to JSON using this library.##### Bencode
```bencode
d5:debug4:truee
```
##### JSON
```json
{
"debug": "true"
}
```
- [Installation](#installation)
- [Usage](#usage)
- [Examples](#examples)
- [License](#license)## Installation
Install the package **Bencode2Json** from [NuGet](https://www.nuget.org/packages/Bencode2Json/)
or install it from the [Package Manager Console](https://docs.microsoft.com/en-us/nuget/tools/package-manager-console):```
PM> Install-Package Bencode2Json
```## Usage
```C#
using Bencode2Json;
...
...
// BencodedData takes any Stream
var bencodedData = new BencodedData(dataStream);
var json = bencodedData.ConvertToJson();
```## Examples
Demos in the Examples folder.#### TorrentFileParser
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.## Reference
- https://en.wikipedia.org/wiki/Bencode
- https://en.wikipedia.org/wiki/Torrent_file## License
[](https://github.com/vijayshinva/Bencode2Json/blob/master/LICENSE)
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fvijayshinva%2FBencode2Json?ref=badge_shield)[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fvijayshinva%2FBencode2Json?ref=badge_large)