I am including a JavaScript from information I found on an article on Medium.com
const jsonldScript = document.createElement('script');
jsonldScript.setAttribute('type', 'application/ld+json');
const structuredData = {
"@context": "https://schema.org/",
"@type": "HowTo",
"name": "How to Package a Parcel",
"description": "UPS will show you how to properly box contents and label packages when you ship so your package contents arrive in good condition. Follow these four easy steps.",
"image": "https://www.ups.com/assets/resources/images/369x276/m15-individual-shipper-preparing-shipping.jpg",
"step": [{
"@type": "HowToStep",
"name":"Choose a box",
"text": "Choose a box strong enough to hold the contents. That means it shouldn't have tears, rips, bends, or other damage. You can use your own box or UPS packaging supplies. Ideally, you'll want to use a new corrugated box.",
"url": "https://www.ups.com/gb/en/services/individual-shipper/preparing-to-ship.page"
},
{
"@type": "HowToStep",
"name":"Select Cushioning Material",
"text": "Select and use proper cushioning materials for package contents. Wrap items individually and surround them with bubble sheeting and recyclable or foam loose-fill materials. Content should not directly touch the inside of the shipping box.",
"url": "https://www.ups.com/gb/en/services/individual-shipper/preparing-to-ship.page"
},
{
"@type": "HowToStep",
"name":"Seal Your Package",
"text": "Securely seal your package. Use pressure-sensitive plastic or nylon reinforced tape that's at least 2 in./5.08 cm wide.",
"url": "https://www.ups.com/gb/en/services/individual-shipper/preparing-to-ship.page"
},
{
"@type": "HowToStep",
"name":"Label Your Package",
"text": "Properly label your package. Include full shipping instructions such as postal codes, apartment numbers or other information that will help with delivery. UPS online shipping can help you complete your label. Make sure to place the label on top of the package and remove any old labels or cross out old markings. Secure the label and avoid placing it on box seams or tape.",
"url": "https://www.ups.com/gb/en/services/individual-shipper/preparing-to-ship.page"
}]
};
jsonldScript.textContent = structuredData;
document.head.appendChild(jsonldScript);