Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

jq error: "map_with/1 is not defined", even though it is defined [closed]

$
0
0
$ echo '{"a": "A", "b": [{"c": 1}, {"c": 2}]}' | jq '.a as $a | .b | map( . += {"a": $a})'[  {"c": 1,"a": "A"  },  {"c": 2,"a": "A"  }]

but

$ echo '{"a": "A", "b": [{"c": 1}, {"c": 2}]}' | jq 'def map_with($map_property; $parent_property_name):     .[$parent_property_name] as $ppv     | .[$map_property] // []     | map( . += { ("_" + $parent_property_name): $ppv}); . | map_with("a", "b")'jq: error: map_with/1 is not defined at <top-level>, line 1:def map_with($map_property; $parent_property_name): .[$parent_property_name] as $ppv | .[$map_property] // [] | map( . += { ("_" + $parent_property_name): $ppv}); . | map_with("a", "b")                                                     jq: 1 compile error

Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>