Try "MXTires Microdata .NET" NuGet Package. Use defined there classes then convert them to JSON-LD by calling ToJson() method. For instance:
var offer = new Offer()
{
Name = "Accessory for your car.",
Availability = ItemAvailability.InStock,
};
offer.ToJason();
The result should like this:
<script type="application/ld+json">{
"availability": "http://schema.org/InStock",
"name": "Accessory for your car.",
"@context": "http://schema.org",
"@type": "Offer"
}</script>