image.png

Category: Objects Kind: Operation Description: Create an object from a list by a key

Inputs

Name Abbreviation Type Access Description
List L Any Item The list to key
Key K String Item The key to key by

Outputs

Name Abbreviation Type Access Description
Object O Object Item The object to key

About key-value pairs

A key-value pair is a fundamental concept in programming and data storage, especially in dictionaries, maps, JSON, and databases.

Basic Idea:

A key-value pair consists of:

Example in Real Life:

Think of a dictionary (the book):

If you look up the key "apple" in the dictionary, the value might be "a fruit that grows on trees".

Example

Take, for example, a real estate listing. It might be stored like this:

property_listing = {
"address": "123 Maple Street",
"price": 450000,
"bedrooms": 3,
"bathrooms": 2,
"square_feet": 1800,
"status": "For Sale"
}

Breakdown of key-value pairs:

KEY VALUE
address 123 Maple Street
price 450000
bedrooms 3
bathrooms 2
square_feet 1800
status For Sale

Each key describes a property attribute, and each value holds the actual data about it.

This kind of structure is super common in databases, and APIs—makes it easy to store, access, and filter lists.

Object entries refer to the key-value pairs within an object. In JavaScript (and similar structures like JSON), these are called entries because each one is a single unit of information: a key and its corresponding value.

Let’s say you have a JavaScript object:

javascript
CopyEdit
const property = {
  address: "123 Maple Street",
  price: 450000,
  bedrooms: 3
};

The entries of this object are:


How-to

  1. Feed in a list

  2. Feed in a string to define the key

    You can use a string node or the result of any node that generates a string

  3. The result is a new object containing the key-value pair(s)