Key-Value Pairs Explained key-value-pairs-explained
Defines and describes standard and serialized key-value pairs.
A key-value pair consists of two related data elements: A key, which is a constant that defines the data set (e.g., gender, color, price), and a value, which is a variable that belongs to the set (e.g., male/female, green, 100). Fully formed, a key-value pair could look like these:
gender = male
color = green
price > 100
Standard and Serialized Key-Value Pairs standard-serialized-pairs
Destinations accept key-value data in standard
or serialized
format. Standard formatting organizes data into separate key-value pairs. Each key is stated explicitly, even when used again to define a different value. By contrast, serialized formatting condenses multiple values into one set defined by a single key. Also, in a serialized pair, a special indicator is used to separate the values within the key-value set. Finally, standard and serialized key-values can contain single or multiple values. The following table provides examples of standard and serial key-value formats.
x=1&x=2
x=1&x=2&y=3&y=4
x=1;2
x=1;2&y=3;4
Keys, Delimiters, and Separators keys-delimiters-separators
When working with serialized data, you must specify the characters that separate values within and between the key-value pairs. Elements in key-value pairs are defined as follows:
- Key: A unique identifier in the key-value pair.
- Value delimiter: Separates individual key-value pairs.
- Key-value separator: Separates a key from the values within a key-value pair.
- Serial separator: Separates individual values within serialized key-value pairs.
Standard and Serialized Key-Value Elements standard-serialized-key-value-elements
x=1&x=2
x
=
&
x=1&x=2&y=3&y=4
x,y
=
&
x=1;2;3
x
=
;
x=1;2&y=3;4
x,y
=
&
;