jmespath.site
jmespath.site copied to clipboard
added items, to_object and zip functions to specification
trafficstars
fixes jmespath/jmespath.jep#20
:+1: yesss!
Given [["one", 1], ["two", 2], ["one", 3]] what should be the output of from_items(@)?
Possible candidates could be: {"one": 1, "two": 2} or {"one": 3, "two": 2} or {"one": [1,3], "two": 2}
@shashankmehra the last pair for any key will win, so in your example, the result will be:
{"one": 3, "two": 2}.
This is consistent with _.fromPairs in JavaScript:
> _.fromPairs([["one", 1], ["two", 2], ["one", 3]])
{ one: 3, two: 2 }
And dict construction in python:
>>> dict([["one", 1], ["two", 2], ["one", 3]])
{'two': 2, 'one': 3}