Disclosure: written by the Health World Web editorial team, who publish healthworldweb.com and the sister site healthysupplements.us. No affiliate links.

If you build anything that reads supplement labels, such as a price comparer or a nutrition tracker, you need a data shape for the Supplement Facts panel. This is a small JSON structure that avoids the usual mistakes, with the reasons for each field.

{ "product": "Example Magnesium", "serving_size": { "amount": 2, "unit": "capsule" }, "servings_per_container": 45, "ingredients": [ { "name": "Magnesium", "form": "magnesium citrate", "amount": 200, "unit": "mg", "basis": "elemental", "percent_dv": 48 } ], "price": { "amount": 18.9, "currency": "USD", "includes_tax_shipping": true } } 

Why these fields

  • serving_size is an object. Every amount on the panel is per serving. Storing "2 capsule" as text makes cost per serving hard to compute.
  • form and basis. "Magnesium (as magnesium citrate) 200 mg" is an elemental amount. "Magnesium citrate 500 mg" is the compound weight. Without basis you will compare numbers that mean different things.
  • percent_dv can be null. Many ingredients have no established daily value, so null must be allowed.
  • price carries its basis. Compare final prices, with tax and shipping, or the ranking is wrong.

Cost per serving

const servings = (c) => c.servings_per_container; const costPerServing = (c) => c.price.amount / servings(c); 

If a user takes half a serving, divide the amounts and multiply the servings by two before comparing.

The label-reading rules behind this are in the label guide, and a free browser tool that does the cost arithmetic is the cost per serving calculator. For batch lab reports, see the certificate of analysis guide.