MXTires.Microdata 1.0.5.2

dotnet add package MXTires.Microdata --version 1.0.5.2
                    
NuGet\Install-Package MXTires.Microdata -Version 1.0.5.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MXTires.Microdata" Version="1.0.5.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MXTires.Microdata" Version="1.0.5.2" />
                    
Directory.Packages.props
<PackageReference Include="MXTires.Microdata" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MXTires.Microdata --version 1.0.5.2
                    
#r "nuget: MXTires.Microdata, 1.0.5.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MXTires.Microdata@1.0.5.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MXTires.Microdata&version=1.0.5.2
                    
Install as a Cake Addin
#tool nuget:?package=MXTires.Microdata&version=1.0.5.2
                    
Install as a Cake Tool

MXTires.Microdata

MXTires.Microdata is framework to correspond schema.org object types to .Net classes with conversion to JSON

Prerequisites

Visual Studio 2008 or higher NuGet

Code example of defining a Product:

https://schema.org/Product

        public void SimpleProduct()
        {
            var product = new Product()
            {
                Name = "T3 REPLICA NISSAN ALTIMA, MAXIMA (PAINTED/SILVER)",
            };
            Review review1 = new Review() { Name = "Review1", ReviewRating = new Rating() { RatingValue = "5" }, ReviewBody = "Best product ever!", Author = new Person() { Name = "Some Guy" } };
            Review review2 = new Review() { Name = "Review2",  ReviewRating = new Rating() { RatingValue = "4" }, ReviewBody = "I've seen better...", Author = new Person() { Name = "Other Guy" } };
            product.Reviews = new List<Review> { review1, review2 };
            System.Diagnostics.Debug.Write(product.ToJson());
        }

Code example of defining an Event:

https://schema.org/Event

        public void EventTest()
        {
            var baseEvent = new Event();
            baseEvent.Attendee = new Person();
            System.Diagnostics.Debug.WriteLine(baseEvent.ToIndentedJson());
        
        }

Code example for image:

        [TestMethod]
        public void TestImageObject()
        {
            var blogPosting = new BlogPosting();
            blogPosting.Image = new ImageObject()
            {
                Url = "http://whatever.com/image.png",
                Width = new QuantitativeValue() { Value = 500 },
                Height = new QuantitativeValue() { Value = 500 }
            };

            System.Diagnostics.Debug.Write(blogPosting.ToIndentedJson());
        }

Output:

<script type="application/ld+json">{
  "image": {
    "height": {
      "value": 500.0,
      "@type": "QuantitativeValue"
    },
    "width": {
      "value": 500.0,
      "@type": "QuantitativeValue"
    },
    "url": "http://whatever.com/image.png",
    "@type": "ImageObject"
  },
  "@context": "https://schema.org",
  "@type": "BlogPosting"
}</script>

@context is written on the root node only; nested nodes inherit it. Setting Context explicitly on a nested node still writes it there.

Enumerations and dates

Enumeration values serialize as their schema.org (or GoodRelations) URI, and a [Flags] combination serializes as an array:

            var offer = new Offer
            {
                Availability = ItemAvailability.InStock,
                AvailableDeliveryMethod = DeliveryMethod.OnSitePickup | DeliveryMethod.UPS,
                PriceValidUntil = new DateTime(2026, 10, 25)
            };
{
  "availability": "https://schema.org/InStock",
  "availableDeliveryMethod": ["https://schema.org/OnSitePickup", "http://purl.org/goodrelations/v1#UPS"],
  "priceValidUntil": "2026-10-25",
  "@context": "https://schema.org",
  "@type": "Offer"
}

Enumeration and number/boolean properties are nullable, so anything left unset is omitted. Properties whose schema.org range is Date are written as yyyy-MM-dd. If you serialize with your own JsonSerializerSettings, add new SchemaEnumConverter() (namespace MXTires.Microdata.Serialization) to its Converters.

Code example with extentions:

        public void TestAtlas()
        {
            var atlas = new Atlas();
            atlas.Context = new List<object>() { "https://schema.org", new Extentions.BibNameSpace(), };
            atlas.Name = "Atlas of the world.";
            System.Diagnostics.Debug.WriteLine(atlas.ToIndentedJson());
        }

Output:

<script type="application/ld+json">{
  "name": "Atlas of the world.",
  "@context": [
    "https://schema.org",
    {
      "bib": "http://bib.schema.org"
    }
  ],
  "@type": "Atlas"
}</script>

Dependencies

Newtonsoft.Json (>= 13.0.3)

License

1010Tires.com. License - License.md

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5.2 142 9/30/2026
1.0.5.1 110 9/26/2026
1.0.5 97 9/26/2026
1.0.4.8 166 9/11/2026
1.0.4.7 101 9/11/2026
1.0.4.6 145 9/11/2026
1.0.4.5 13,938 5/28/2023
1.0.4.4 867 3/17/2023
1.0.4.3 949 2/8/2023
1.0.4.2 1,054 12/12/2022
1.0.4.1 3,481 12/28/2021
1.0.4 16,888 11/18/2020
1.0.3.9 57,125 11/12/2020
1.0.3.8 11,929 6/9/2020
1.0.3.7 867 6/3/2020
Loading failed

DefinedRegion.PostalCodePrefix now accepts several prefixes as well as one: a string, or any list of strings (serialized as a JSON array), matching schema.org, where a Text property can repeat. A region such as "Western Canada" spans several postal-code prefixes (S, T, V), which a single string could not express. Any other type throws ArgumentException. The property is now typed object, so code that reads it as a string needs a cast; code that sets a string is unchanged. See ChangeLog.md for details.