--- title: dict.fromList() function description: > `dict.fromList()` creates a dictionary from a list of records with `key` and `value` properties. menu: flux_v0_ref: name: dict.fromList parent: dict identifier: dict/fromList weight: 101 --- `dict.fromList()` creates a dictionary from a list of records with `key` and `value` properties. ##### Function type signature ```js (pairs: [{value: B, key: A}]) => [A:B] where A: Comparable ``` {{% caption %}} For more information, see [Function type signatures](/flux/v0/function-type-signatures/). {{% /caption %}} ## Parameters ### pairs ({{< req >}}) List of records with `key` and `value` properties. ## Examples ### Create a dictionary from a list of records ```js import "dict" d = dict.fromList( pairs: [{key: 1, value: "foo"}, {key: 2, value: "bar"}], )// Returns [1: "foo", 2: "bar"] ```