From fcfacb932d329457fc9b6837d3fcf6fffb6c4496 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Thu, 23 Apr 2015 18:25:32 -0500 Subject: [PATCH] from_entries is broken (fix #767) --- builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin.c b/builtin.c index bf614864..348c965c 100644 --- a/builtin.c +++ b/builtin.c @@ -1258,7 +1258,7 @@ static const char* const jq_builtins[] = { "def recurse_down: recurse;", "def to_entries: [keys_unsorted[] as $k | {key: $k, value: .[$k]}];", - "def from_entries: map({(.key // .Key // .Name): (.value // .Value)}) | add | .//={};", + "def from_entries: map({(.key // .Key // .Name): (if has(\"value\") then .value else .Value end)}) | add | .//={};", "def with_entries(f): to_entries | map(f) | from_entries;", "def reverse: [.[length - 1 - range(0;length)]];", "def indices($i): if type == \"array\" and ($i|type) == \"array\" then .[$i]"