Skip to main content

How to handle values table using "JSON" attributes ?

Written by Lucien Berkani

The JSON attribute type allows to manage hierarchical data such as key values but also, for example, tables of nutritional values, complex information on composition, seasons ...

Let’s take the example of a food product for which we need to store various nutritional values.

Without a JSON attribute, we might have to create several attributes (Energy, fat, sugars, etc.).

We may also need to manage this information for different units, such as 100 g, 100 ml or a portion. This can quickly make the data model complex. With a JSON attribute, all of this information can be grouped together in a single structure.

Let’s imagine an attribute called nutritional_values.

Its value could be:

{ "serving": "100g", "energy": { "kcal": 250, "kj": 1046 }, "fat": { "value": 12, "unit": "g" }, "saturated_fat": { "value": 4, "unit": "g" }, "carbohydrates": { "value": 30, "unit": "g" }, "sugars": { "value": 8, "unit": "g" }, "protein": { "value": 6, "unit": "g" }, "salt": { "value": 0.5, "unit": "g" } }

The ‘nutrition_values’ attribute therefore contains all the necessary structure for describing the product’s nutritional values.

This is a very useful attribute if flows are set up in your PIM ecosystem. It is not editable from the interface.

The information is most often coming from the PIM's upstream systems (ERP, PLM...) and is only passing through the PIM to feed other systems. However, they are readable by users, and many of us do not know how and when to use this type of attribute.

For more information, see our online documentation:

Key words: JSON, attribute, raw, table

Did this answer your question?