Clone wiki

OpenBadges.Model / Home

OpenBadges Model C# Library

Welcome to the home for OpenBadges Model C# Library. This library is intended to help dealing with serialization/deserialization of OpenBadges specifications in a C# environment.

You can find all the related information about Mozilla OpenBadges and its implementation at and


Just use Nuget (

  • Search for "OpenBadges.Model" with the Library Package Manager in VS.
  • Or type in the Package Manager Console

    Install-Package OpenBadges.Model

This will install the reference to the library in your project.

Features supported

The library represents the whole model specified at Badge Assertion Specs.

Playing with it

Here is a small example that makes some calls using the model. Put it on a small Console project:


using OpenBadges.Model.Assertion;

private static void Main(string[] args)
    // Badge Assertion sample JSON string
    String json = @"{
                    ""uid"": ""f2c20"",
                    {   ""type"": ""email"",
                        ""hashed"": true,
                        ""salt"": ""deadsea"",
                        ""identity"": ""sha256$c7ef86405ba71b85acd8e2e95166c4b111448089f2e1599f42fe1bba46e865c5""
                    ""image"": """",
                    ""evidence"": """",
                    ""issuedOn"": 1359217910,
                    ""badge"": """",
                    {   ""type"": ""hosted"",
                        ""url"": """"

    // Build a BadgeAssertion from a JSON string
    // via constructor:
    IBadgeAssertion badgeAssertion = new BadgeAssertion(json);
    // via static load method:
    IBadgeAssertion badge = BadgeAssertion.Load(json);

    // Convert the BadgeAssertion object to JSON (plain & indented)
    Console.WriteLine(badgeAssertion.ToJson(indented: true));

    // ToString method is overrided to get the JSON string representing the badge, as well



This is a first alpha release, so it's not as stable as it could be, but enough to play around with it. The source code will be open sourced soon so that you could contribute and improve it if you wish ;) Use it at your own risk.

I am not related with OpenBadges in any way. This is not an official OpenBadges library. It's just a small piece of my work :)

The license applied for using this software is the MIT License.