title: ansible jinja or python; calculation on a dynamic json structure
body: <p>I am working on ansible 2.5, python 2.7.
  I have to execute a calculation on a dynamic json variable.
  The variable is dynamic; it can contain from 1 to 1000 objects:
  example:</p>
  
  <blockquote>
  <pre><code>var: [
      {   "name": "object1",
          "value": 1,
          "oper": 2
      },
      {   "name": "objectN",
          "value": 40,
          "oper": 8
      }
   ]
  </code></pre>
  </blockquote>
  
  <p>The operation I have to execute is quite basic:
  result = (var.object_1.value * var.object_1.oper) + (var.object_2.value * var.object_2.oper) + (var.object_N.value * var.object_N.oper) ...
  How to deal with this operation? Is there a jinja function the work with json structure or do I have to create a custom "ansible filter" to work with python functions? 
  Thanks all for your advises!</p>