Skip to content

Instantly share code, notes, and snippets.

@yukelele
Last active December 24, 2017 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yukelele/d7b7119396d15be66dba032501697f26 to your computer and use it in GitHub Desktop.
Save yukelele/d7b7119396d15be66dba032501697f26 to your computer and use it in GitHub Desktop.
yogurt_data_as_python_dictionary
Here is a listing of the complete `cola_data` json object after it was:
* converted to a Python dictionary
* printed out by the `pprint` command
------------ yogurt_data -------------
{'code': '0894700010045',
'product': {'_id': '0894700010045',
'_keywords': ['greek',
'on',
'bottom',
'the',
'chobani',
'yogurt',
'non-fat',
'strawberry'],
'additives': ' [ nonfat-yogurt -> en:nonfat-yogurt ] [ yogurt '
'-> en:yogurt ] [ cultured-pasteurized-nonfat-milk '
'-> en:cultured-pasteurized-nonfat-milk ] [ '
'pasteurized-nonfat-milk -> '
'en:pasteurized-nonfat-milk ] [ nonfat-milk -> '
'en:nonfat-milk ] [ milk -> en:milk ] [ '
'evaporated-cane-juice -> en:evaporated-cane-juice '
'] [ cane-juice -> en:cane-juice ] [ juice -> '
'en:juice ] [ strawberries -> en:strawberries ] '
'[ water -> en:water ] [ pectin -> en:e440i -> '
'exists -- ok ] [ natural-flavors -> '
'en:natural-flavors ] [ flavors -> en:flavors ] '
'[ locust-bean-gum -> en:e410 -> exists -- ok ] '
'[ fruit-and-vegetable-juice-concentrate -> '
'en:fruit-and-vegetable-juice-concentrate ] [ '
'and-vegetable-juice-concentrate -> '
'en:and-vegetable-juice-concentrate ] [ '
'vegetable-juice-concentrate -> '
'en:vegetable-juice-concentrate ] [ '
'juice-concentrate -> en:juice-concentrate ] [ '
'concentrate -> en:concentrate ] [ for-color -> '
'en:for-color ] [ color -> en:colour ] ',
'additives_debug_tags': ['en-e440i-added'],
'additives_n': 2,
'additives_old_n': 0,
'additives_old_tags': [],
'additives_original_tags': ['en:e440i', 'en:e410'],
'additives_prev': ' [ nonfat-yogurt -> en:nonfat-yogurt ] [ '
'yogurt -> en:yogurt ] [ '
'cultured-pasteurized-nonfat-milk -> '
'en:cultured-pasteurized-nonfat-milk ] [ '
'pasteurized-nonfat-milk -> '
'en:pasteurized-nonfat-milk ] [ nonfat-milk '
'-> en:nonfat-milk ] [ milk -> en:milk ] [ '
'evaporated-cane-juice -> '
'en:evaporated-cane-juice ] [ cane-juice -> '
'en:cane-juice ] [ juice -> en:juice ] [ '
'strawberries -> en:strawberries ] [ water -> '
'en:water ] [ pectin -> en:e440 -> exists '
'-- ok ] [ natural-flavors -> '
'en:natural-flavors ] [ flavors -> '
'en:flavors ] [ locust-bean-gum -> en:e410 '
'-> exists -- ok ] [ '
'fruit-and-vegetable-juice-concentrate -> '
'en:fruit-and-vegetable-juice-concentrate ] [ '
'and-vegetable-juice-concentrate -> '
'en:and-vegetable-juice-concentrate ] [ '
'vegetable-juice-concentrate -> '
'en:vegetable-juice-concentrate ] [ '
'juice-concentrate -> en:juice-concentrate ] '
'[ concentrate -> en:concentrate ] [ '
'for-color -> en:for-color ] [ color -> '
'en:fd-c ] ',
'additives_prev_n': 2,
'additives_prev_original_tags': ['en:e440', 'en:e410'],
'additives_prev_tags': ['en:e410', 'en:e440'],
'additives_tags': ['en:e410', 'en:e440', 'en:e440i'],
'allergens': '',
'allergens_hierarchy': [],
'allergens_tags': [],
'brands': 'Chobani',
'brands_debug_tags': [],
'brands_tags': ['chobani'],
'checkers_tags': [],
'code': '0894700010045',
'codes_tags': ['code-13',
'0894700010045',
'089470001004x',
'08947000100xx',
'0894700010xxx',
'089470001xxxx',
'08947000xxxxx',
'0894700xxxxxx',
'089470xxxxxxx',
'08947xxxxxxxx',
'0894xxxxxxxxx',
'089xxxxxxxxxx',
'08xxxxxxxxxxx',
'0xxxxxxxxxxxx'],
'complete': 0,
'correctors_tags': ['usda-ndb-import'],
'countries': 'US',
'countries_debug_tags': [],
'countries_hierarchy': ['en:united-states'],
'countries_tags': ['en:united-states'],
'created_t': 1489057761,
'creator': 'usda-ndb-import',
'editors_tags': ['openfoodfacts-contributors', 'usda-ndb-import'],
'entry_dates_tags': ['2017-03-09', '2017-03', '2017'],
'fruits-vegetables-nuts_100g_estimate': 0,
'id': '0894700010045',
'informers_tags': ['openfoodfacts-contributors',
'usda-ndb-import'],
'ingredients': [{'id': 'nonfat-yogurt',
'rank': 1,
'text': 'Nonfat yogurt'},
{'id': 'cultured-pasteurized-nonfat-milk',
'rank': 2,
'text': 'cultured pasteurized nonfat milk'},
{'id': 'evaporated-cane-juice',
'rank': 3,
'text': 'evaporated cane juice'},
{'id': 'strawberries',
'rank': 4,
'text': 'strawberries'},
{'id': 'water', 'rank': 5, 'text': 'water'},
{'id': 'pectin', 'rank': 6, 'text': 'pectin'},
{'id': 'natural-flavors',
'rank': 7,
'text': 'natural flavors'},
{'id': 'locust-bean-gum',
'rank': 8,
'text': 'locust bean gum'},
{'id': 'fruit-and-vegetable-juice-concentrate',
'rank': 9,
'text': 'fruit and vegetable juice concentrate'},
{'id': 'for-color',
'rank': 10,
'text': 'for color'},
{'id': '', 'rank': 11, 'text': '.'}],
'ingredients_debug': ['Nonfat yogurt ',
'(',
'cultured pasteurized nonfat milk)',
',',
' evaporated cane juice',
',',
' strawberries',
',',
' water',
',',
' pectin',
',',
' ',
':',
' natural flavors ',
':',
' ',
',',
' locust bean gum',
',',
' fruit and vegetable juice concentrate ',
'(',
'for color).'],
'ingredients_from_or_that_may_be_from_palm_oil_n': 0,
'ingredients_from_palm_oil_n': 0,
'ingredients_from_palm_oil_tags': [],
'ingredients_ids_debug': ['nonfat-yogurt',
'cultured-pasteurized-nonfat-milk',
'evaporated-cane-juice',
'strawberries',
'water',
'pectin',
'natural-flavors',
'locust-bean-gum',
'fruit-and-vegetable-juice-concentrate',
'for-color'],
'ingredients_n': '11',
'ingredients_n_tags': ['11', '11-20'],
'ingredients_tags': ['nonfat-yogurt',
'cultured-pasteurized-nonfat-milk',
'evaporated-cane-juice',
'strawberries',
'water',
'pectin',
'natural-flavors',
'locust-bean-gum',
'fruit-and-vegetable-juice-concentrate',
'for-color',
''],
'ingredients_text': 'Nonfat yogurt (cultured pasteurized nonfat '
'milk), evaporated cane juice, strawberries, '
'water, pectin, natural flavors, locust bean '
'gum, fruit and vegetable juice concentrate '
'(for color).',
'ingredients_text_debug': 'Nonfat yogurt (cultured pasteurized '
'nonfat milk), evaporated cane juice, '
'strawberries, water, pectin, : natural '
'flavors : , locust bean gum, fruit and '
'vegetable juice concentrate (for '
'color).',
'ingredients_text_en': 'Nonfat yogurt (cultured pasteurized '
'nonfat milk), evaporated cane juice, '
'strawberries, water, pectin, natural '
'flavors, locust bean gum, fruit and '
'vegetable juice concentrate (for color).',
'ingredients_text_with_allergens': 'Nonfat yogurt (cultured '
'pasteurized nonfat milk), '
'evaporated cane juice, '
'strawberries, water, pectin, '
'natural flavors, locust bean '
'gum, fruit and vegetable '
'juice concentrate (for '
'color).',
'ingredients_text_with_allergens_en': 'Nonfat yogurt (cultured '
'pasteurized nonfat milk), '
'evaporated cane juice, '
'strawberries, water, '
'pectin, natural flavors, '
'locust bean gum, fruit and '
'vegetable juice '
'concentrate (for color).',
'ingredients_that_may_be_from_palm_oil_n': 0,
'ingredients_that_may_be_from_palm_oil_tags': [],
'interface_version_created': 'import_us_ndb.pl - version '
'2017/03/04',
'lang': 'en',
'languages': {'en:english': 2},
'languages_codes': {'en': 2},
'languages_hierarchy': ['en:english'],
'languages_tags': ['en:english', 'en:1'],
'last_edit_dates_tags': ['2017-03-09', '2017-03', '2017'],
'last_editor': 'usda-ndb-import',
'last_modified_by': 'usda-ndb-import',
'last_modified_t': 1489057761,
'lc': 'en',
'misc_tags': ['en:nutrition-no-fruits-vegetables-nuts',
'en:nutrition-no-fiber-or-fruits-vegetables-nuts',
'en:nutriscore-computed'],
'nutrient_levels': {},
'nutrient_levels_tags': [],
'nutriments': {'calcium': 0.1,
'calcium_100g': 0.1,
'calcium_serving': 0.15,
'calcium_unit': 'mg',
'calcium_value': '100',
'carbohydrates': 12.67,
'carbohydrates_100g': 12.67,
'carbohydrates_serving': '19',
'carbohydrates_unit': 'g',
'carbohydrates_value': '12.67',
'cholesterol': 0.003,
'cholesterol_100g': 0.003,
'cholesterol_serving': 0.0045,
'cholesterol_unit': 'mg',
'cholesterol_value': '3',
'energy': '335',
'energy_100g': '335',
'energy_serving': '502',
'energy_unit': 'kcal',
'energy_value': '80',
'fat': '0',
'fat_100g': '0',
'fat_serving': '0',
'fat_unit': 'g',
'fat_value': '0.00',
'fiber': '0',
'fiber_100g': '0',
'fiber_serving': '0',
'fiber_unit': 'g',
'fiber_value': '0',
'iron': '0',
'iron_100g': '0',
'iron_serving': '0',
'iron_unit': 'mg',
'iron_value': '0.00',
'nutrition-score-fr': -2,
'nutrition-score-fr_100g': -2,
'nutrition-score-uk': -2,
'nutrition-score-uk_100g': -2,
'potassium': 0.153,
'potassium_100g': 0.153,
'potassium_serving': 0.229,
'potassium_unit': 'mg',
'potassium_value': '153',
'proteins': '8',
'proteins_100g': '8',
'proteins_serving': '12',
'proteins_unit': 'g',
'proteins_value': '8.00',
'salt': 0.1016,
'salt_100g': 0.1016,
'salt_serving': 0.152,
'saturated-fat': '0',
'saturated-fat_100g': '0',
'saturated-fat_serving': '0',
'saturated-fat_unit': 'g',
'saturated-fat_value': '0.00',
'sodium': 0.04,
'sodium_100g': 0.04,
'sodium_serving': 0.06,
'sodium_unit': 'mg',
'sodium_value': '40',
'sugars': '10',
'sugars_100g': '10',
'sugars_serving': '15',
'sugars_unit': 'g',
'sugars_value': '10.00',
'trans-fat': '0',
'trans-fat_100g': '0',
'trans-fat_serving': '0',
'trans-fat_unit': 'g',
'trans-fat_value': '0.00',
'vitamin-a': '0',
'vitamin-a_100g': '0',
'vitamin-a_serving': '0',
'vitamin-a_unit': 'IU',
'vitamin-a_value': '0',
'vitamin-c': '0',
'vitamin-c_100g': '0',
'vitamin-c_serving': '0',
'vitamin-c_unit': 'mg',
'vitamin-c_value': '0'},
'nutrition_data_per': '100g',
'nutrition_grade_fr': 'a',
'nutrition_grades': 'a',
'nutrition_grades_tags': ['a'],
'nutrition_score_debug': ' -- energy 0 + sat-fat 0 + '
'fr-sat-fat-for-fats 0 + sugars 2 + '
'sodium 0 - fruits 0% 0 - fiber 0 - '
'proteins 4 -- fsa -2 -- fr -2',
'nutrition_score_warning_no_fruits_vegetables_nuts': 1,
'photographers_tags': [],
'product_name': 'Greek Non-Fat Yogurt, Strawberry On The Bottom',
'product_name_en': 'Greek Non-Fat Yogurt, Strawberry On The '
'Bottom',
'quality_tags': [],
'rev': 3,
'serving_quantity': 150,
'serving_size': '150 g (150 g)',
'sortkey': 489057761,
'sources': [{'fields': ['product_name_en',
'brands',
'countries',
'serving_size',
'ingredients_text_en',
'nutrients.energy',
'nutrients.proteins',
'nutrients.fat',
'nutrients.carbohydrates',
'nutrients.fiber',
'nutrients.sugars',
'nutrients.calcium',
'nutrients.iron',
'nutrients.potassium',
'nutrients.sodium',
'nutrients.vitamin-c',
'nutrients.vitamin-a',
'nutrients.saturated-fat',
'nutrients.trans-fat',
'nutrients.cholesterol'],
'id': 'usda-ndb',
'images': [],
'import_t': 1489057761,
'url': 'https://api.nal.usda.gov/ndb/reports/?ndbno=45039471&type=f&format=json&api_key=DEMO_KEY'}],
'states': 'en:to-be-completed, en:nutrition-facts-completed, '
'en:ingredients-completed, '
'en:expiration-date-to-be-completed, '
'en:packaging-code-to-be-completed, '
'en:characteristics-to-be-completed, '
'en:categories-to-be-completed, en:brands-completed, '
'en:packaging-to-be-completed, '
'en:quantity-to-be-completed, '
'en:product-name-completed, en:photos-to-be-uploaded',
'states_hierarchy': ['en:to-be-completed',
'en:nutrition-facts-completed',
'en:ingredients-completed',
'en:expiration-date-to-be-completed',
'en:packaging-code-to-be-completed',
'en:characteristics-to-be-completed',
'en:categories-to-be-completed',
'en:brands-completed',
'en:packaging-to-be-completed',
'en:quantity-to-be-completed',
'en:product-name-completed',
'en:photos-to-be-uploaded'],
'states_tags': ['en:to-be-completed',
'en:nutrition-facts-completed',
'en:ingredients-completed',
'en:expiration-date-to-be-completed',
'en:packaging-code-to-be-completed',
'en:characteristics-to-be-completed',
'en:categories-to-be-completed',
'en:brands-completed',
'en:packaging-to-be-completed',
'en:quantity-to-be-completed',
'en:product-name-completed',
'en:photos-to-be-uploaded'],
'unknown_nutrients_tags': [],
'update_key': 'nutriscore-20171111'},
'status': 1,
'status_verbose': 'product found'}
{% endhighlight %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment