solutions/A Tour of Nix/16.nix

9 lines
272 B
Nix
Raw Normal View History

2024-04-16 19:13:00 -04:00
let
list = [ { name = "foo"; value = 123; }
{ name = "bar"; value = 456; } ];
string = ''{"x": [1, 2, 3], "y": null}'';
in
{
ex0 = builtins.listToAttrs list == { foo = 123; bar = 456; };
ex1 = builtins.fromJSON string == { x = [ 1 2 3 ]; y = null; };
}