{"id":16626558,"url":"https://github.com/hhblaze/biser","last_synced_at":"2025-07-18T19:03:37.145Z","repository":{"id":55890726,"uuid":"122081310","full_name":"hhblaze/Biser","owner":"hhblaze","description":"Biser is a cross-platform Binary and JSON Serializer for .NET / dotnet / core / standard / CoreRT / Mono WASM / C#","archived":false,"fork":false,"pushed_at":"2024-10-17T19:32:40.000Z","size":8360,"stargazers_count":43,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-06T19:52:56.592Z","etag":null,"topics":["alternative","binary","cross-platform","dbreeze","decoder","encoder","framework","javascript","json","net","netcore","netstandard","protobuf","protobuf-net","raft","react","reactjs","serialization","serializer","vue"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hhblaze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"custom":null}},"created_at":"2018-02-19T15:24:38.000Z","updated_at":"2025-06-25T16:49:54.000Z","dependencies_parsed_at":"2024-10-28T11:08:48.455Z","dependency_job_id":null,"html_url":"https://github.com/hhblaze/Biser","commit_stats":{"total_commits":213,"total_committers":1,"mean_commits":213.0,"dds":0.0,"last_synced_commit":"00325a5f65181b1ac0b23df3e9891d74046a4e27"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/hhblaze/Biser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhblaze%2FBiser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhblaze%2FBiser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhblaze%2FBiser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhblaze%2FBiser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhblaze","download_url":"https://codeload.github.com/hhblaze/Biser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhblaze%2FBiser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265815124,"owners_count":23832843,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alternative","binary","cross-platform","dbreeze","decoder","encoder","framework","javascript","json","net","netcore","netstandard","protobuf","protobuf-net","raft","react","reactjs","serialization","serializer","vue"],"created_at":"2024-10-12T04:10:51.389Z","updated_at":"2025-07-18T19:03:37.095Z","avatar_url":"https://github.com/hhblaze.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Biser.NET\n[![Image of Build](https://img.shields.io/badge/License-BSD%203,%20FOSS-FC0574.svg)](https://github.com/hhblaze/Biser/blob/master/LICENSE)\n![Image of Build](https://img.shields.io/badge/Roadmap-completed-33CC33.svg)\n[![NuGet Badge](https://buildstats.info/nuget/Biser)](https://www.nuget.org/packages/Biser/)\n[![NuGet Badge](https://buildstats.info/nuget/BiserObjectify)](https://www.nuget.org/packages/BiserObjectify/)\n[![Image of Build](https://img.shields.io/badge/Powered%20by-tiesky.com-1883F5.svg)](http://tiesky.com)\n\nCross-platform BINARY and JSON serializer for .NET dotnet.\n\n- Doesn't use reflection inside, only managed code, perfectly works in [MONO WASM](https://github.com/aspnet/Blazor) and [CoreRT](https://github.com/dotnet/corert) where AOT compilers are used,\nthat makes it a possible alternative to [protobuf-net](https://github.com/mgravell/protobuf-net), [MessagePack](https://github.com/neuecc/MessagePack-CSharp),  [NetJSON](https://github.com/rpgmaker/NetJSON), [JSON.NET](https://www.newtonsoft.com/json).\n- Has the same [operational speed (Benchmark)](https://github.com/hhblaze/Biser/blob/master/Benchmark/Program.cs) as protobuf-net and NetJSON, smaller payload and a tiny source code.\n- Has custom encoding possibilities of any complexity.\n- Different encoding/decoding scenarios for one object are supported.\n- Thread safe. No need to \"warm up\" serializing/encoding entities.\n\n\nIntegrated part of [DBreeze database](https://github.com/hhblaze/DBreeze), used in [Raft.NET](https://github.com/hhblaze/Raft.Net)\n\n### Quick start\n\n- Grab from NuGet **Biser** (or **DBreeze** that contains Biser), grab from Nuget **BiserObjectify**.\n- Let’s assume you have several objects to serialize. It is necessary to prepare them: \n\nCall next line to create code for the serialzer:\n```C#\n var resbof = BiserObjectify.Generator.Run(typeof(TS6),true, \n      @\"D:\\Temp\\1\\\", forBiserBinary: true, forBiserJson: true, null);\n```\n\nFirst argument is the type of the root object to be serialized (it can contain other objects that also must be serialized).\nSecond argument means that BiserObjectify must prepare serializer for all objects included into the root object.\nThird argument points to the folder where C# files per object will be created.\nThe fourth and fifth arguments mean that we want to use both Binary and JSON serializers.\nThe sixth argument is a HashSet (or null) with the property names that will not be serialized.\n\nresbof variable will contain the same information that in generated files also as a Dictionary.\n\n- Copy generated files into your project and embed/link them to the project. Try to recompile. \n- Probably, it will be necessary to add “partial” keyword to objects that must be serialized:\n\n```C#\n public partial class TS6\n    {\n        public string P1 { get; set; }\n...\n```\n\n- Remove BiserObjectify from your project, it will not be necessary until next time.\nUsage:\n```C#\n TS6 t6 = new TS6()\n            {                \n                P1 = \"dsfs\",\n                P2 = 456,\n                P3 = DateTime.UtcNow,\n                P4 = new List\u003cDictionary\u003cDateTime, Tuple\u003cint, string\u003e\u003e\u003e\n                    {\n                        new Dictionary\u003cDateTime, Tuple\u003cint, string\u003e\u003e{\n                            { DateTime.UtcNow.AddMinutes(-1), new Tuple\u003cint, string\u003e(12,\"testvar\") },\n                            { DateTime.UtcNow.AddMinutes(-2), new Tuple\u003cint, string\u003e(125,\"testvar123\") }\n                        },\n                        new Dictionary\u003cDateTime, Tuple\u003cint, string\u003e\u003e{\n                            { DateTime.UtcNow.AddMinutes(-3), new Tuple\u003cint, string\u003e(17,\"dsfsdtestvar\") },\n                            { DateTime.UtcNow.AddMinutes(-4), new Tuple\u003cint, string\u003e(15625,\"sdfsdtestvar\") }\n                        }\n                    },\n                P5 = new Dictionary\u003cint, Tuple\u003cint, string\u003e\u003e {\n                     { 12, new Tuple\u003cint, string\u003e(478,\"dsffdf\") },\n                     { 178, new Tuple\u003cint, string\u003e(5687,\"sdfsd\") }\n                 },\n                P6 = new Tuple\u003cint, string, Tuple\u003cList\u003cstring\u003e, DateTime\u003e\u003e(445, \"dsfdfgfgfg\", \n                new Tuple\u003cList\u003cstring\u003e, DateTime\u003e(new List\u003cstring\u003e { \"a1\", \"a2\" }, DateTime.Now.AddDays(58))),\n                P7 = new List\u003cstring\u003e { \"fgdfgrdfg\", \"dfgfdgdfg\" },\n                P8 = new Dictionary\u003cint, List\u003cstring\u003e\u003e {\n                        { 34,new List\u003cstring\u003e { \"drtttz\",\"ghhtht\"} },\n                        { 4534,new List\u003cstring\u003e { \"dfgfghfgz\",\"6546ghhtht\"} }\n                    },\n\t\t\t\t\t\n\t\t\t\tP25 = new Dictionary\u003cint, List\u003cstring[,][][,,]\u003e\u003e[,,,][][,,]\n\n...\n}\n\n```\n\n\n#### Binary serialization:\n```C#\n var serializedObjectAsByteArray = t6.BiserEncoder().Encode();\n var retoredBinaryObject= TS6.BiserDecode(serializedObjectAsByteArray);\n```\n\n###### NOTE (for Binary serializer only)\n - To have consistent data, after first serialization and storing byte[] into database - never delete serialized object/class properties.\n - To have consistent data, after first serialization and storing byte[] into database - add new properties only to the end of the object/class, after all other properties are listed.\n\n#### JSON serialization:\n```C#\n var jsonSettings = new Biser.JsonSettings { DateFormat = Biser.JsonSettings.DateTimeStyle.ISO };\n string prettifiedJsonString = new Biser.JsonEncoder(t6, jsonSettings)\n            .GetJSON(Biser.JsonSettings.JsonStringStyle.Prettify);\n var restoredJsonObject= TS6.BiserJsonDecode(prettifiedJsonString, settings: jsonSettings);\n```\n\n###### NOTE (for JSON serializer only)\n - JSON serializer can also store multi-dimensional arrays like [,,] [,] [,,,] etc., representing it as a Tuple\u003cList\u003cint\u003e, object itself\u003e where Item1 represents array dimensions. \n\n \n \n\n###### Example of the [TS6 object for serialization](https://github.com/hhblaze/Biser/blob/da3a6ef3e993f8cb820f4ba497fdc714f68c95da/BiserTest_Net/TS6.cs) and generated by BiserObjectify [Binary and JSON serializer](https://github.com/hhblaze/Biser/blob/da3a6ef3e993f8cb820f4ba497fdc714f68c95da/BiserTest_Net/TS6_Biser.cs)\n\n\n \n-------------\nFor the deep understanding:\n\n- [Documentation binary Biser](https://docs.google.com/document/d/e/2PACX-1vQa3C506Esw3Fkroj4OA5erGOHEZpAtnXcQQ90R0w1wnFqO_16CH0dUfBJZt_ppB15ykoZWI9eR8KcG/pub)\n- [Documentation JSON Biser](https://docs.google.com/document/d/e/2PACX-1vQa3C506Esw3Fkroj4OA5erGOHEZpAtnXcQQ90R0w1wnFqO_16CH0dUfBJZt_ppB15ykoZWI9eR8KcG/pub#id.yqadcf2f2moz)\n\n- [Examples of manual encoders/decoders](https://github.com/hhblaze/Biser/blob/master/BiserTest_Net)\n-------------\n\nhhblaze@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhblaze%2Fbiser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhblaze%2Fbiser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhblaze%2Fbiser/lists"}