From f58f771660c9c543a81e08d31a5711debdc4fb86 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 16 Jun 2014 22:40:44 -0500 Subject: [PATCH] Fix #280: from_entries of [] is null, should be {} --- builtin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin.c b/builtin.c index e17fc45..dc625aa 100644 --- a/builtin.c +++ b/builtin.c @@ -707,7 +707,7 @@ static const char* const jq_builtins[] = { "def recurse(f): ., (f | select(. != null) | recurse(f));", "def recurse_down: recurse(.[]?);", "def to_entries: [keys[] as $k | {key: $k, value: .[$k]}];", - "def from_entries: map({(.key): .value}) | add;", + "def from_entries: map({(.key): .value}) | 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] elif type == \"array\" then .[[i]] else .[i] end;", -- 2.40.0