---
title: "Structured Data using Schema.NET - Muhammad Rehan Saeed"
description: "Schema.NET is Schema.org objects turned into strongly typed C# POCO classes for use in .NET."
canonical_url: "https://rehansaeed.com/structured-data-using-schema-net/"
last_updated: "2017-07-02T00:00:00+00:00"
meta:
  author: "Muhammad Rehan Saeed"
  keywords: ".NET,.NET Core,Bing,C#,Google,Schema.NET,Schema.org,Search Engines,Structured Data"
  "og:description": "Schema.NET is Schema.org objects turned into strongly typed C# POCO classes for use in .NET."
  "og:image": "https://rehansaeed.com/_og/s/o_cdca06881751b77b.png"
  "og:image:alt": "Structured Data using Schema.NET - Muhammad Rehan Saeed"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Structured Data using Schema.NET"
  "twitter:image": "https://rehansaeed.com/_og/s/o_cdca06881751b77b.png"
  "twitter:image:alt": "Structured Data using Schema.NET - Muhammad Rehan Saeed"
---

> Index of every page on this site: [llms.txt](https://rehansaeed.com/llms.txt)

# [Structured Data using Schema.NET](https://rehansaeed.com/structured-data-using-schema-net/)

Posted 2 July 2017 - **2 min read**

![Schema.NET](https://rehansaeed.com/_ipx/f_png&s_2560x1440/images/hero/Schema.NET-1366x768.png)

# What is Schema.org? Link to this section

[Schema.org](https://schema.org) defines a set of standard classes and their properties for objects and services in the real world. There are nearly 700 classes at the time of writing defined by schema.org. This machine readable format is a common standard used across the web for describing things.

# Where is Schema.org Used? Link to this section

### Websites Link to this section

Websites can define Structured Data in the head section of their html to enable search engines to show richer information in their search results. Here is an example of how [Google](https://developers.google.com/search/docs/guides/intro-structured-data) can display extended metadata about your site in it's search results.

![Google Logo Structured Data Example](https://rehansaeed.com/_ipx/f_png&s_2560x3900/content-images/posts/2017/structured-data-using-schema-net/images/Google-Logo-Structured-Data-Example.png)

Using structured data in html requires the use of a script tag with a MIME type of `application/ld+json` like so:

```html
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Organization",
  "url": "http://www.example.com",
  "name": "Unlimited Ball Bearings Corp.",
  "contactPoint": {
    "@type": "ContactPoint",
    "telephone": "+1-401-555-1212",
    "contactType": "Customer service"
  }
}
</script>
```

### Windows UWP Sharing Link to this section

Windows UWP apps let you share data using schema.org classes. [Here](https://docs.microsoft.com/en-us/uwp/schemas/appxpackage/appxmanifestschema/element-sharetarget) is an example showing how to share metadata about a book.

# Enter Schema.NET Link to this section

Schema.NET is Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD. Here is a simple Schema.NET example that defines the name and URL of a website:

```cs
var website = new WebSite()
{
    AlternateName = "An Alternative Name",
    Name = "Your Site Name",
    Url = new Uri("https://example.com")
};
var jsonLd = website.ToString();
```

The code above outputs the following JSON-LD:

```json
{
    "@context":"http://schema.org",
    "@type":"WebSite",
    "alternateName":"An Alternative Name",
    "name":"Your Site Name",
    "url":"https://example.com"
}
```

There are dozens more examples based on Google's Structured Data documentation with links to the relevant page in the unit tests of the Schema.NET project.

# Classes & Properties Link to this section

schema.org defines classes and properties, where each property can have a single value or an array of multiple values. Additionally, properties can have multiple types e.g. an `Address` property could have a type of `string` or a type of `PostalAddress` which has it's own properties such as `StreetAddress` or `PostalCode` which breaks up an address into it's constituent parts.

To facilitate this Schema.NET uses some clever C# generics and implicit type conversions so that setting a single or multiple values is possible and that setting a `string` or `PostalAddress` is also possible:

```cs
// Single string address
var organization = new Organization()
{
    Address = "123 Old Kent Road E10 6RL"
};

// Multiple string addresses
var organization = new Organization()
{
    Address = new List<string>()
    { 
        "123 Old Kent Road E10 6RL",
        "456 Finsbury Park Road SW1 2JS"
    }
};

// Single PostalAddress address
var organization = new Organization()
{
    Address = new PostalAddress()
    {
        StreetAddress = "123 Old Kent Road",
        PostalCode = "E10 6RL"
    }
};

// Multiple PostalAddress addresses
var organization = new Organization()
{
    Address = new List<PostalAddress>()
    {
        new PostalAddress()
        {
            StreetAddress = "123 Old Kent Road",
            PostalCode = "E10 6RL"
        },
        new PostalAddress()
        {
            StreetAddress = "456 Finsbury Park Road",
            PostalCode = "SW1 2JS"
        }
    }
};
```

This magic is all carried out using the `Value<T>`, `Value<T1, T2>`, `Value<T1, T2, T3>` etc. types. These types are all `structs` for best performance too.

# Where to Get It? Link to this section

Download the Schema.NET [NuGet package](https://www.nuget.org/packages/Schema.NET) or take a look at the code on [GitHub](https://github.com/RehanSaeed/Schema.NET). At some point I'll find the time to write a quick ASP.NET Core tag helper that wraps Schema.NET.

## Web Mentions

[What's this?](https://en.wikipedia.org/wiki/Webmention)

### 0 Linked

### 0 Replies

## GitHub Comments

### 20 Comments

[Comment on GitHub](https://github.com/RehanSaeed/rehansaeed.github.io/issues/117)

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Chad Boettcher](https://camo.githubusercontent.com/a2c14a954904cf9b09d9d003b7de4a1b4b69209dad89253341beef1a020745e3/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f30313032663366303665326366363464343463626539643636353639376538363f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/a2c14a954904cf9b09d9d003b7de4a1b4b69209dad89253341beef1a020745e3/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f30313032663366303665326366363464343463626539643636353639376538363f733d393626643d6d6d26723d67) **Chad Boettcher** commented on **2017-09-01 19:02:41**

I'm having a problem initializing `Values` objects. For example, if I'm creating an `Organization` object, how to I initialize an `Awards` object with 2 awards?

```
var organization = new Organization()
{
    Address = new PostalAddress()
    {
        StreetAddress = this.CurrentWebsite.CustomerServiceAddress1,
        AddressLocality = this.CurrentWebsite.CustomerServiceCity,
        AddressRegion = this.CurrentWebsite.CustomerServiceState,
        PostalCode = this.CurrentWebsite.CustomerServicePostalCode,
        AddressCountry = "US"
    },
    Award = new Values()
    {
        // How do you do this for "Award 1" and "Award 2"
    },
};
```

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Chad Boettcher](https://camo.githubusercontent.com/a2c14a954904cf9b09d9d003b7de4a1b4b69209dad89253341beef1a020745e3/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f30313032663366303665326366363464343463626539643636353639376538363f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/a2c14a954904cf9b09d9d003b7de4a1b4b69209dad89253341beef1a020745e3/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f30313032663366303665326366363464343463626539643636353639376538363f733d393626643d6d6d26723d67) **Chad Boettcher** commented on **2017-09-06 22:39:55**

```
Award = new List()
{
    "Award 1",
    "Award 2"
},
```

By the way, you sir, are a genius. This package saved me a TON of time! Thanks!

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2017-09-12 15:20:22**

> I'm having a problem initializing `Values` objects. For example, if I'm creating an `Organization` object, how to I initialize an `Awards` object with 2 awards?
>
> ```
> var organization = new Organization()
> {
>     Address = new PostalAddress()
>     {
>         StreetAddress = this.CurrentWebsite.CustomerServiceAddress1,
>         AddressLocality = this.CurrentWebsite.CustomerServiceCity,
>         AddressRegion = this.CurrentWebsite.CustomerServiceState,
>         PostalCode = this.CurrentWebsite.CustomerServicePostalCode,
>         AddressCountry = "US"
>     },
>     Award = new Values()
>     {
>         // How do you do this for "Award 1" and "Award 2"
>     },
> };
> ```

This question is better suited to a GitHub issue. Like so:

```
var organization = new Organization()
{
    Award = new List<string>()
    {
        "Award 1",
        "Award 2"
    },
};
```

You can use a `List<T>` or `T[]` array.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Steve](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67) **Steve** commented on **2018-05-10 04:48:46**

Great work!

I have a question tho, how can we set the `dateCreated` to just the year of the book published?

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2018-05-10 10:43:33**

> Great work!
>
> I have a question tho, how can we set the `dateCreated` to just the year of the book published?

I'm not sure what you mean but you can just set the property to a `DateTimeOffset` value.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Steve](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67) **Steve** commented on **2018-05-10 10:55:56**

> I'm not sure what you mean but you can just set the property to a DateTimeOffset value.

Normally, for our collection of books, we only have the publication year (we do not have the complete date)... How can we set the `dateCreated` to just the year (eg 2007)? The `DateTimeOffset` data type requires year, month and day.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2018-05-10 11:01:28**

> Normally, for our collection of books, we only have the publication year (we do not have the complete date)... How can we set the `dateCreated` to just the year (eg 2007)? The `DateTimeOffset` data type requires year, month and day.

According to https://schema.org/dateCreated, the `dateCreated` type only supports `date` or `dateTime` types. So setting the year alone is not possible.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Steve](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67) **Steve** commented on **2018-05-10 11:19:25**

I understand.

In https://schema.org/Date, it mentions that it should follow [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) format. Which allows `yyyy` date format.

> ISO 8601 prescribes, as a minimum, a four-digit year \[YYYY]...  
> [W3](https://www.w3.org/TR/NOTE-datetime)

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020 (edited 12 May 2020)

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2018-05-10 11:27:15**

> I understand.
>
> In https://schema.org/Date, it mentions that it should follow [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) format. Which allows `yyyy` date format.
> > ISO 8601 prescribes, as a minimum, a four-digit year \[YYYY]...  
> > [W3](https://www.w3.org/TR/NOTE-datetime)

Yes you are right...that's an interesting problem. The only way I can think to resolve it is for every `date` property like `dateCreated`, to add a format property like `dateCreatedFormat` which would take a C# date format string. This could then be used in the serialization/deserialization.

Please do raise an issue in the [Schema.NET GitHub site](https://github.com/RehanSaeed/Schema.NET). We'll see if we can get that implemented or also feel free to submit a pull request.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Steve](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/2253fc04efe9b10828b0002a4c514841d80a3bb84f8f50b6237a226c03938fd1/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f39613936623563346639613465316531623435666436363131363261383237323f733d393626643d6d6d26723d67) **Steve** commented on **2018-05-10 11:53:09**

> Yes you are right...that's an interesting problem. The only way I can think to resolve it is for every `date` property like `dateCreated`, to add a format property like `dateCreatedFormat` which would take a C# date format string. This could then be used in the serialization/deserialization.
>
> Please do raise an issue in the Schema.NET GitHub page. We'll see if we can get that implemented or also feel free to submit a pull request.

Done. :)

Thanks for the quick response! Cheers!

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Asad Butt](https://camo.githubusercontent.com/3bca6ee902096e385ca80d4fae24b8c71d5d0b6957ff37c7821cb642186e01dc/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32383630313061636636333636343366396365363362633537633865653830393f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/3bca6ee902096e385ca80d4fae24b8c71d5d0b6957ff37c7821cb642186e01dc/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32383630313061636636333636343366396365363362633537633865653830393f733d393626643d6d6d26723d67) **[Asad Butt](https://www.quoracreative.com/)** commented on **2018-06-23 21:46:37**

Thanks for this wonderful work. I'm having slight problem with adding `logo` to my structure as it is not part of `Article` object.  
 Any thoughts on that ?  
 Thanks

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2018-06-24 11:33:11**

> Thanks for this wonderful work. I'm having slight problem with adding `logo` to my structure as it is not part of `Article` object.  
>  Any thoughts on that ?  
>  Thanks

Logo is not part of the [article](https://schema.org/Article) object on schema.org.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Vikas Singh](https://camo.githubusercontent.com/a4dccdb263db53745302198d7c6b6f5e0d9ae6c30b6058974ba29e8064832bf2/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f36346132323435376435636261386661363561306364303463303163333765663f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/a4dccdb263db53745302198d7c6b6f5e0d9ae6c30b6058974ba29e8064832bf2/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f36346132323435376435636261386661363561306364303463303163333765663f733d393626643d6d6d26723d67) **Vikas Singh** commented on **2018-11-29 09:45:02**

I'm having a problem initializing `MedicalSpeciality` objects. For example, if I'm creating an `Physician` object, how to I initialize a `MedicalSpeciality` with multiple speciality?

```
var physician = new Physician()
{
    Name = objModel.DoctorPersonalVM.DoctorName,
    Url = new Uri(Request.Url.GetLeftPart(UriPartial.Authority) + objModel.DoctorPersonalVM.Slug),
    Description = objModel.DoctorPersonalVM.AboutMe,
    MedicalSpecialty = new MedicalSpecialty()
    {
        objModel.DoctorPersonalVM.Speciality
    }
    Award = new List<string>() 
    {
        objModel.DoctorPersonalVM.AwardName,
    },
};
```

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020 (edited 12 May 2020)

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2018-12-01 11:00:50**

> I'm having a problem initializing `MedicalSpeciality` objects. For example, if I'm creating an `Physician` object, how to I initialize a `MedicalSpeciality` with multiple speciality?

> ```
> var physician = new Physician()
> {
>     Name = objModel.DoctorPersonalVM.DoctorName,
>     Url = new Uri(Request.Url.GetLeftPart(UriPartial.Authority) + objModel.DoctorPersonalVM.Slug),
>     Description = objModel.DoctorPersonalVM.AboutMe,
>     MedicalSpecialty = new MedicalSpecialty()
>     {
>         objModel.DoctorPersonalVM.Speciality
>     }
>     Award = new List<string>() 
>     {
>         objModel.DoctorPersonalVM.AwardName,
>     },
> };
> ```

Please raise a [GitHub issue](https://github.com/RehanSaeed/Schema.NET). This is not the right place to post issues.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Zander](https://camo.githubusercontent.com/f6605fcc6a0907a25d27a24f41ee83989f2bd37424d10dad3c6b020b78a63412/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32663834646233373563376133373034633539326630383339326134363538393f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/f6605fcc6a0907a25d27a24f41ee83989f2bd37424d10dad3c6b020b78a63412/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32663834646233373563376133373034633539326630383339326134363538393f733d393626643d6d6d26723d67) **Zander** commented on **2019-04-01 13:36:41**

Great work, Rehan!

I'm a bit confused - is there a way to deserialize JSON schema into Schema.NET C# `Book` type (for example)?

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2019-04-01 14:04:19**

> Great work, Rehan!
>
> I'm a bit confused - is there a way to deserialize JSON schema into Schema.NET C# `Book` type (for example)?

You can just use standard JSON serialization for that. See [unit tests](https://github.com/RehanSaeed/Schema.NET/blob/master/Tests/Schema.NET.Test/BookTest.cs).

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020 (edited 12 May 2020)

[![Asim Shahzad](https://camo.githubusercontent.com/3023ac2e87d2b19dde9e8566ea5d70d784360ecd83bfaccc8e69ddef39dec40c/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f36663332343731373637343637653137656539666436313435353232663135393f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/3023ac2e87d2b19dde9e8566ea5d70d784360ecd83bfaccc8e69ddef39dec40c/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f36663332343731373637343637653137656539666436313435353232663135393f733d393626643d6d6d26723d67) **Asim Shahzad** commented on **2019-07-17 13:19:58**

Hi,

I have implement your solution. When I test it in google testing tool, tool does not show any thing to me. what will be the expected reason?

I'm using asp.net mvc.

```
{"@context":"http://schema.org","@type":"Organization","name":"Malik Express","sameAs":"https://www.facebook.com/malikexpress","url":"https://malikexpress.com","address":{"@type":"PostalAddress","addressCountry":"PK","addressLocality":"Islamabad","addressRegion":"ICT","postalCode":"44000","streetAddress":"Javed Plaza, A.K. Fazl-ul-Haq Rd, Block A G 6/3 Blue Area, Islamabad, Islamabad Capital Territory 44000"},"email":"info@malikexpress.com","logo":"https://malikexpress.com/Tempate/img/logo.png"}
```

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![Muhammad Rehan Saeed](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/8a07049df41b8a3839a3f4342f09ea8e6e7fa0065667687f04beca2d088a1dca/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f32623266393030653361633066353535316462646537323864336262343935343f733d393626643d6d6d26723d67) **[Muhammad Rehan Saeed](https://rehansaeed.com/)** commented on **2019-07-17 16:23:35**

> hi,
>
> I have implement your solution. When I test it in google testing tool, tool does not show any thing to me. what will be the expected reason?
>
> I'm using asp.net mvc.
>
> ```
> {"@context":"http://schema.org","@type":"Organization","name":"Malik Express","sameAs":"https://www.facebook.com/malikexpress","url":"https://malikexpress.com","address":{"@type":"PostalAddress","addressCountry":"PK","addressLocality":"Islamabad","addressRegion":"ICT","postalCode":"44000","streetAddress":"Javed Plaza, A.K. Fazl-ul-Haq Rd, Block A G 6/3 Blue Area, Islamabad, Islamabad Capital Territory 44000"},"email":"info@malikexpress.com","logo":"https://malikexpress.com/Tempate/img/logo.png"}
> ```

Hard to say with this much information.

[![RehanSaeed](https://avatars.githubusercontent.com/u/2270364?v=4)](https://github.com/RehanSaeed)

### [RehanSaeed](https://github.com/RehanSaeed)

Owner

12 May 2020

[![larrybud](https://camo.githubusercontent.com/9787f69276c3053e3a94595e760a2893759ed32baaf9120a4dc85edba2c8104b/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f36633866613530353031333764613566616664343566343038393631363730303f733d393626643d6d6d26723d67)](https://camo.githubusercontent.com/9787f69276c3053e3a94595e760a2893759ed32baaf9120a4dc85edba2c8104b/68747470733a2f2f7777772e67726176617461722e636f6d2f6176617461722f36633866613530353031333764613566616664343566343038393631363730303f733d393626643d6d6d26723d67) **larrybud** commented on **2020-01-14 01:10:19**

It should be noted that to output this in razor syntax, you must use

```
@Html.Raw()
```

So the example above which says:

```
var jsonLd = website.ToString();
```

The output should be

```
@Html.Raw(website)
```

If you just do

```
@jsonLd
```

You'll get html encoded strings, which is no good.

[![Kk-112688](https://avatars.githubusercontent.com/u/4987011?v=4)](https://github.com/Kk-112688)

### [Kk-112688](https://github.com/Kk-112688)

5 July 2022

Hi Rehan,

I have a doubt regarding SiteNavigationElement. Can you please tell me where can we assign the list of SiteNavigationElement in Website object. Unable to find. Thanks.

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://rehansaeed.com/#website","@type":"WebSite","description":"Software Developer at Microsoft, YouTuber, Open Source Contributor and Blogger","inLanguage":"en-GB","name":"Muhammad Rehan Saeed","url":"https://rehansaeed.com/","author":{"@id":"https://rehansaeed.com/#identity"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://rehansaeed.com/?search={search_term_string}"},"query-input":"required name=search_term_string"}],"publisher":{"@id":"https://rehansaeed.com/#publisher"}},{"@id":"https://rehansaeed.com/structured-data-using-schema-net/#webpage","@type":"WebPage","dateModified":"2017-07-02T00:00:00+00:00","datePublished":"2017-07-02T00:00:00+00:00","description":"Schema.NET is Schema.org objects turned into strongly typed C# POCO classes for use in .NET.","name":"Structured Data using Schema.NET","url":"https://rehansaeed.com/structured-data-using-schema-net/","breadcrumb":{"@id":"https://rehansaeed.com/structured-data-using-schema-net/#breadcrumb"},"isPartOf":{"@id":"https://rehansaeed.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://rehansaeed.com/structured-data-using-schema-net/"]}]},{"@id":"https://rehansaeed.com/#identity","@type":"Person","name":"Muhammad Rehan Saeed","url":"https://rehansaeed.com/about/","image":{"@id":"https://rehansaeed.com/#/schema/image/1"},"sameAs":["https://github.com/RehanSaeed","https://www.linkedin.com/in/muhammad-rehan-saeed","https://stackoverflow.com/users/1212017/muhammad-rehan-saeed","https://www.youtube.com/c/MuhammadRehanSaeed","https://www.twitch.tv/rehansaeeduk"]},{"@id":"https://rehansaeed.com/#publisher","@type":"Organization","logo":"https://rehansaeed.com/images/schema/Publisher-600x60.png","name":"Muhammad Rehan Saeed","url":"https://rehansaeed.com"},{"@id":"https://rehansaeed.com/structured-data-using-schema-net/#article","@type":"Article","dateModified":"2017-07-02T00:00:00+00:00","datePublished":"2017-07-02T00:00:00+00:00","description":"Schema.NET is Schema.org objects turned into strongly typed C# POCO classes for use in .NET.","headline":"Structured Data using Schema.NET","inLanguage":"en-GB","url":"https://rehansaeed.com/structured-data-using-schema-net/","author":{"@id":"https://rehansaeed.com/#identity"},"image":[{"@type":"ImageObject","url":"https://rehansaeed.com/images/hero/Schema.NET-1366x768.png","caption":"Schema.NET","width":"1366","height":"768"}],"isPartOf":{"@id":"https://rehansaeed.com/structured-data-using-schema-net/#webpage"},"keywords":[".NET",".NET Core","Bing","C#","Google","Schema.NET","Schema.org","Search Engines","Structured Data"],"mainEntityOfPage":{"@id":"https://rehansaeed.com/structured-data-using-schema-net/#webpage"},"publisher":{"@id":"https://rehansaeed.com/#publisher"}},{"@id":"https://rehansaeed.com/structured-data-using-schema-net/#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Blog","item":"https://rehansaeed.com/","position":1},{"@type":"ListItem","name":"Structured Data using Schema.NET","item":"https://rehansaeed.com/structured-data-using-schema-net/","position":2}]},{"@id":"https://rehansaeed.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://rehansaeed.com/images/author/Muhammad-Rehan-Saeed/Logo-512x512.png","inLanguage":"en-GB","url":"https://rehansaeed.com/images/author/Muhammad-Rehan-Saeed/Logo-512x512.png"}]}
```

## Sitemap

See the full [sitemap](https://rehansaeed.com/sitemap.md) for all pages.
