How to Parse Messy Recipe Text into Clean JSON (in Seconds)
Instantly turn messy recipe text into clean, USDA-backed JSON with this free nutrition API. Try it in the live playground and get started in under 5 minutes.
Messy recipe text is a nightmare.
If you've ever tried to build a food or nutrition app, you've probably run into the same problem:
2 cups fresh spinach, 1 large salmon fillet (about 6 oz), 1 tbsp olive oil, 1/2 avocado sliced, 1 cup quinoa cookedHumans can read that easily — but your code? Not so much. You end up fighting with regex, lookups, and inconsistent formatting.
That's why I built the Avocavo Nutrition API. It takes any ingredient list — no matter how messy — and returns clean, structured JSON in under 0.2 seconds.
Example: From messy text to perfect JSON
Input:
2 cups fresh spinach, 1 large salmon fillet (about 6 oz), 1 tbsp olive oil, 1/2 avocado sliced, 1 cup quinoa cookedOutput (shortened for clarity):
[
{
"name": "spinach, fresh",
"amount": 2,
"unit": "cup",
"calories": 14.0,
"protein_g": 1.8,
"fat_g": 0.2,
"carbs_g": 2.2,
"fiber_g": 1.4,
"source": "USDA:11457",
"confidence": 0.95
},
{
"name": "salmon, atlantic, farmed",
"amount": 6,
"unit": "oz",
"calories": 412.0,
"protein_g": 55.6,
"fat_g": 18.4,
"carbs_g": 0,
"omega_3_mg": 2586,
"source": "USDA:15236",
"confidence": 0.93
},
{
"name": "olive oil",
"amount": 1,
"unit": "tbsp",
"calories": 119.0,
"protein_g": 0,
"fat_g": 13.5,
"carbs_g": 0,
"vitamin_e_mg": 1.94,
"source": "USDA:04053",
"confidence": 0.98
}
]You get full macros, micronutrients, and direct USDA references for every ingredient.
🚀 Try it right now
Test the API with your own recipe text in our interactive playground
Open Playground →How to try it (free)
- Step 1: Open the Playground
- Step 2: Paste in your ingredient list and hit Run
- Step 3: See structured JSON instantly
API Integration Example
JavaScript/Node.js
fetch("https://app.avocavo.app/api/v2/nutrition/recipe", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"ingredients": [
"2 cups fresh spinach",
"1 large salmon fillet (about 6 oz)",
"1 tbsp olive oil",
"1/2 avocado sliced",
"1 cup quinoa cooked"
],
"servings": 1
})
})
.then(res => res.json())
.then(data => {
console.log('Nutrition data:', data);
// Process your clean, structured data
});Python
import requests
response = requests.post(
'https://app.avocavo.app/api/v2/nutrition/recipe',
headers={
'X-API-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
"ingredients": [
"2 cups fresh spinach",
"1 large salmon fillet (about 6 oz)",
"1 tbsp olive oil",
"1/2 avocado sliced",
"1 cup quinoa cooked"
],
"servings": 1
}
)
nutrition_data = response.json()
print(f"Total calories: {nutrition_data['total_calories']}")
print(f"Protein: {nutrition_data['total_protein_g']}g")cURL
curl -X POST https://app.avocavo.app/api/v2/nutrition/recipe" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"ingredients": [
"2 cups fresh spinach",
"1 large salmon fillet (about 6 oz)",
"1 tbsp olive oil",
"1/2 avocado sliced",
"1 cup quinoa cooked"
],
"servings": 1
}'🔑 Get your free API key
Sign up in 30 seconds and get 500 free API calls to get started
Sign Up Free →Why developers love this API
Fast
Responses in ~200ms. Built for production workloads.
Accurate
Direct USDA data with no scraping or guesswork.
Easy
Works with plain text, doesn't require strict formatting.
Free tier
Perfect for prototypes, hobby projects, and MVPs.
Real-world use cases
- Recipe apps: Parse user-submitted recipes for nutrition labels
- Meal planning: Calculate macro targets for custom meal plans
- Fitness tracking: Log food intake from natural language
- E-commerce: Add nutrition facts to food product listings
- Restaurant tech: Auto-generate nutrition data for menu items
What's included in the response
Every ingredient includes:
- • Calories
- • Protein, carbs, fat
- • Fiber and sugar
- • 20+ vitamins & minerals
- • USDA FDC ID for verification
- • Confidence score
- • Standardized unit conversions
- • Allergen information
🚀 Ready to turn messy recipe text into clean JSON?
Join 500+ developers already building with the Avocavo API
Avocavo Team
Building developer-friendly nutrition APIs to power the next generation of food and health apps.