All Projects → RehanSaeed → Schema.net

RehanSaeed / Schema.net

Licence: mit
Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD and XML, typically used to represent structured data in the head section of html page.

Projects that are alternatives of or similar to Schema.net

React Structured Data
React Structured Data provides an easy way to add structured data to your React apps
Stars: ✭ 120 (-64.29%)
Mutual labels:  schema-org, schema, json-ld
Schema Generator
PHP Model Scaffolding from Schema.org and other RDF vocabularies
Stars: ✭ 379 (+12.8%)
Mutual labels:  schema-org, schema, json-ld
php-schema.org-mapping
A fluent interface to create mappings using Schema.org for Microdata and JSON-LD.
Stars: ✭ 31 (-90.77%)
Mutual labels:  schema, schema-org, json-ld
ddi-xslt
XSLT transformations for DDI XML-files to other formats
Stars: ✭ 21 (-93.75%)
Mutual labels:  schema-org, json-ld
Schema Microdata Examples
Some examples of HTML markup using Schema.org microdata
Stars: ✭ 58 (-82.74%)
Mutual labels:  schema-org, schema
schema-and-structured-data-for-wp
Creating the best Structured Data and Schema plugin for WordPress
Stars: ✭ 66 (-80.36%)
Mutual labels:  schema, schema-org
Ultimate Metatags
A large snippet for your page's <head> that includes all the meta tags you'll need for OPTIMAL sharing and SEO. Extensive work has been put into ensuring you have the optimal images for the most important social media platforms.
Stars: ✭ 24 (-92.86%)
Mutual labels:  schema-org, schema
really-rich-results
RRR makes structured data for WordPress really rich, and really easy.
Stars: ✭ 21 (-93.75%)
Mutual labels:  schema, schema-org
schemify
Automatically generate Schema.org JSON-LD markup for WordPress content.
Stars: ✭ 58 (-82.74%)
Mutual labels:  schema, json-ld
seomate
SEO, mate! It's important. That's why SEOMate provides the tools you need to craft all the meta tags, sitemaps and JSON-LD microdata you need - in one highly configurable, open and friendly package - with a super-light footprint.
Stars: ✭ 31 (-90.77%)
Mutual labels:  schema-org, json-ld
coffeediz.schema
Набор компонентов 1С-Битрикс для реализации микроразметки по схеме Schema.org
Stars: ✭ 14 (-95.83%)
Mutual labels:  schema, schema-org
Structured Data Testing Tool
A library and command line tool to help inspect and test for Structured Data.
Stars: ✭ 34 (-89.88%)
Mutual labels:  schema-org, json-ld
schemaorg-jsd
JSON Schema validation for JSON-LD files using Schema.org vocabulary.
Stars: ✭ 16 (-95.24%)
Mutual labels:  schema-org, json-ld
WG3-MetadataSpecifications
WG3 Metadata Specification
Stars: ✭ 25 (-92.56%)
Mutual labels:  schema-org, json-ld
schema-dot-org
Validated structured data for websites
Stars: ✭ 42 (-87.5%)
Mutual labels:  schema-org, json-ld
Json Silo
Contextual data silo for the IoT and Smart Spaces. We believe in an open Internet of Things.
Stars: ✭ 10 (-97.02%)
Mutual labels:  schema-org, json-ld
ngx-json-ld
📝 A small component to easily bind JSON-LD schema to Angular templates.
Stars: ✭ 29 (-91.37%)
Mutual labels:  schema-org, json-ld
Schema Dts
JSON-LD TypeScript types for Schema.org vocabulary
Stars: ✭ 338 (+0.6%)
Mutual labels:  schema-org, json-ld
Flatfiles
Reads and writes CSV, fixed-length and other flat file formats with a focus on schema definition, configuration and speed.
Stars: ✭ 275 (-18.15%)
Mutual labels:  schema, dotnet-core
React Schemaorg
Type-checked Schema.org JSON-LD for React
Stars: ✭ 262 (-22.02%)
Mutual labels:  schema-org, json-ld

Schema.NET Banner

Schema.NET NuGet Package Schema.NET Azure Artifacts Package Twitter URL Twitter Follow

Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD and XML, typically used to represent structured data in the head section of html page.

Simple Example

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:

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

If writing the result into a <script> element, be sure to use the .ToHtmlEscapedString() method instead to avoid exposing your website to a Cross-Site Scripting attack. See the example below.

What is Schema.org?

schema.org defines a set of standard classes and their properties for objects and services in the real world. This machine readable format is a common standard used across the web for describing things.

Where is Schema.org Used?

Websites

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 can display extended metadata about your site in it's search results.

Google Logo Structured Data Example

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

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

When serializing the result for a website's <script> tag, you should use the alternate .ToHtmlEscapedString() to avoid exposing yourself to a Cross-Site Scripting (XSS) vulnerability if some of the properties in your schema have been set from untrusted sources. Usage in an ASP.NET MVC project might look like this:

<script type="application/ld+json">
    @Html.Raw(Model.Schema.ToHtmlEscapedString())
</script>

Windows UWP Sharing

Windows UWP apps let you share data using schema.org classes. Here is an example showing how to share metadata about a book.

Classes & Properties

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:

// 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"
        }
    }
};

// Mixed Author types
var book = new Book()
{
    Author = new List<object>()
    {
        new Organization() { Name = "Penguin" },
        new Person() { Name = "J.D. Salinger" }
    }
};

// Deconstruct a property containing mixed types
if (book.Author.HasValue)
{
    var (organisations, people) = book.Author.Value;
}

This magic is all carried out using implicit conversion operators in the OneOrMany<T>, Values<T1, T2>, Values<T1, T2, T3> and Values<T1, T2, T3, T4> types. These types are all structs for best performance too.

More Examples

For more examples and actual running code samples, take a look at the unit tests in the project source code.

Continuous Integration

Name Operating System Status History
Azure Pipelines Ubuntu Azure Pipelines Ubuntu Build Status
Azure Pipelines Mac Azure Pipelines Mac Build Status
Azure Pipelines Windows Azure Pipelines Windows Build Status
Azure Pipelines Overall Azure Pipelines Overall Build Status Azure DevOps Build History
GitHub Actions Ubuntu, Mac & Windows GitHub Actions Status GitHub Actions Build History
AppVeyor Ubuntu, Mac & Windows AppVeyor Build Status AppVeyor Build History

Contributions and Thanks

Please view the contributing guide for more information.

  • kirkone - CI reads .NET Core version from new global.json file.
  • Turnerj - Added System.Text.Json support, Had all types implement IEquatable<T> GetHashCode and added extra unit tests and bug fixes.
  • shervinw - Added better null value handling for structs.
  • kirk-marple - Refactoring JSON serialization to be more efficient.
  • nickevansuk - Adding better null value handling and use HTTPS instead of HTTP.
  • MEmanuelsson - Added support for the schema.org Date type without time.
  • halovanic - For adding interfaces to Schema.NET types for greater flexibility.
  • AndreSteenbergen - For enabling the tool to work on linux.
  • benmccallum - For adding XSS vlnerability protection.
  • psampaio - Added deserialization support and unit tests.
  • icunningham88 - Improved a test.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].