networktocode/jdiff

Single value not supported in expression

Closed this issue · 2 comments

In case an user wants to get extract just one element from the json object, he has to pass it in a list anyway

"global.$peers$.*.is_enabled" won't work
returns: ({'index_element[3]': {'new_value': False, 'old_value': True}}, False)

"global.$peers$.*.[is_enabled]" will work
returns: ({'7.7.7.7': {'is_enabled': {'new_value': False, 'old_value': True}}}, False)

We can either fix or document as requirement

I would document for now, and if we get more feedback, act.

Update.
After recent changes the proper key anchor is "global.peers.$*$.is_enabled"
It fails at:

if len(items) != len(my_key_value_list):

Helper functions expect list-wrapped data.
"global.peers.*.is_enabled" returns [True, True, False, True], while helpers expect [[True], [True], [False], [True]]