Its handy to be able to set facts from json.

ansible filters

Sample code to extract and set fact from json. In this case json is from command line executable output.

1) capture command line output

  - name: register product name
    shell: lshw -json -quiet
    register: lshw_json

2) using from_json

  - name: lshw_json
      lshw_product_name: "{{ (lshw_json.stdout | from_json).children[0].product }}"