with each element being an attribute–value pair. Depending on the particular application and the implementation chosen by programmers, attribute names may or may not be unique.
Examples of use
Some of the applications where information is represented as name-value pairs are:
* E-mail
Electronic mail (usually shortened to email; alternatively hyphenated e-mail) is a method of transmitting and receiving Digital media, digital messages using electronics, electronic devices over a computer network. It was conceived in the ...
, in RFC 2822 headers
* Query string
A query string is a part of a uniform resource locator ( URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML doc ...
s, in URL
A uniform resource locator (URL), colloquially known as an address on the Web, is a reference to a resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identi ...
s
* Optional elements in network protocol
A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any variation of a physical quantity. The protocol defines the rules, syntax, semantics, and synchronization of ...
s, such as IP, where they often appear as TLV (''type–length–value'') triples
* Bibliographic information, as in BibTeX
BibTeX is both a bibliographic flat-file database file format and a software program for processing these files to produce lists of references (citations). The BibTeX file format is a widely used standard with broad support by reference manage ...
and Dublin Core
140px, Logo of DCMI, maintenance agency for Dublin Core Terms
The Dublin Core vocabulary, also known as the Dublin Core Metadata Terms (DCMT), is a general purpose metadata vocabulary for describing resources of any type. It was first developed ...
metadata
* Element attributes in SGML
The Standard Generalized Markup Language (SGML; International Organization for Standardization, ISO 8879:1986) is a standard for defining generalized markup languages for documents. ISO 8879 Annex A.1 states that generalized markup is "based on t ...
, HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
and XML
Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
* Key–value databases
* OpenStreetMap
OpenStreetMap (abbreviated OSM) is a free, Open Database License, open geographic database, map database updated and maintained by a community of volunteers via open collaboration. Contributors collect data from surveying, surveys, trace from Ae ...
map data
* Windows registry
The Windows Registry is a hierarchical database that stores low-level settings for the Microsoft Windows operating system and for applications that opt to use the registry. The kernel, device drivers, services, Security Accounts Manager, a ...
entries
* Environment variables
An environment variable is a user-definable Value (computer science), value that can affect the way running process (computing), processes will behave on a computer. Environment variables are part of the environment in which a process runs. Fo ...
Use in computer languages
Some computer language
A computer language is a formal language used to communicate with a computer. Types of computer languages include:
* Software construction#Construction languages, Construction language – all forms of communication by which a human can Comput ...
s implement name–value pairs, or more frequently collections of attribute–value pairs, as standard language features. Most of these implement the general model of an associative array
In computer science, an associative array, key-value store, map, symbol table, or dictionary is an abstract data type that stores a collection of (key, value) pairs, such that each possible key appears at most once in the collection. In math ...
: an unordered list of unique attributes with associated values. As a result, they are not fully general; they cannot be used, for example, to implement electronic mail headers (which are ordered and non-unique).
In some applications, a name–value pair has a value that contains a nested collection of attribute–value pairs. Some data serialization
In computing, serialization (or serialisation, also referred to as pickling in Python (programming language), Python) is the process of translating a data structure or object (computer science), object state into a format that can be stored (e. ...
formats such as JSON
JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
support arbitrarily deep nesting.
Other data representations are restricted to one level of nesting, such as INI file's section/name/value.
See also
* Attribute (computing)
In computing, an attribute is a specification that defines a property of an object, element, or file. It may also refer to or set the specific value for a given instance of such. For clarity, attributes should more correctly be considered m ...
* Entity–attribute–value model
* Query string
A query string is a part of a uniform resource locator ( URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML doc ...
* Key–value database
References
{{DEFAULTSORT:Name-value pair
Data modeling