{
  "schemaVersion": 1,
  "slug": "grams-to-cups-converter",
  "category": "cooking",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "5d7a5688492d659fa632154ac38754b17c3c7af09f341f240d2fab83e4e3e9a2",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/grams-to-cups-converter.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "cups = g/d; tbsp = 16g/d",
    "vars": [
      [
        "g",
        "Weight in grams"
      ],
      [
        "d",
        "Grams per cup for the ingredient"
      ],
      [
        "cups",
        "Volume in cups"
      ],
      [
        "tbsp",
        "Volume in tablespoons"
      ]
    ],
    "note": "d is a lookup: flour 125, bread flour 127, sugar 200, brown sugar 220, butter 227, water 236, milk 244, rice 185, oats 90, cocoa 85, honey 340, salt 288; unknown ingredient defaults to 125."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "King Arthur Baking — Ingredient weight chart",
        "url": "https://www.kingarthurbaking.com/learn/ingredient-weight-chart"
      }
    ],
    "referenceRole": "input",
    "implementationHash": "5d7a5688492d659fa632154ac38754b17c3c7af09f341f240d2fab83e4e3e9a2",
    "basis": "cups = g/d; tbsp = 16g/d",
    "limitations": "Use the cited guidance and your own measurements, bills or product specifications to choose inputs. Sample defaults are not current local data."
  },
  "contract": {
    "compute": "const D = { flour:125, breadflour:127, sugar:200, brownsugar:220, butter:227, water:236, milk:244, rice:185, oats:90, cocoa:85, honey:340, salt:288 }; const perCup = D[ingredient] || 125; const cups = grams/perCup; return { cups, tablespoons: cups*16, gramsPerCup: perCup };",
    "inputs": [
      {
        "name": "grams",
        "type": "number",
        "default": 250,
        "min": 0,
        "max": 1000000,
        "step": 1
      },
      {
        "name": "ingredient",
        "type": "select",
        "default": "flour",
        "options": [
          {
            "value": "flour"
          },
          {
            "value": "breadflour"
          },
          {
            "value": "sugar"
          },
          {
            "value": "brownsugar"
          },
          {
            "value": "butter"
          },
          {
            "value": "water"
          },
          {
            "value": "milk"
          },
          {
            "value": "rice"
          },
          {
            "value": "oats"
          },
          {
            "value": "cocoa"
          },
          {
            "value": "honey"
          },
          {
            "value": "salt"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "cups",
        "precision": 4,
        "unit": "cups"
      },
      {
        "name": "tablespoons",
        "precision": 1,
        "unit": "tbsp"
      },
      {
        "name": "gramsPerCup",
        "precision": 0,
        "unit": "g"
      }
    ],
    "interpret": null
  }
}
