title: Ansible JSON output with debug=ON
body: <p>When I run a playbook on which I register the command output onto a register and assign that to msg with debug true with my ansible.cfg as below
  stdout_callback = json
  retry_files_enabled = False</p>
  
  <p>I get the desired output of "hosts" 2 times.</p>
  
  <p>ANSIBLE VERSION</p>
  
  <pre><code>ansible 2.5.2
  </code></pre>
  
  <p>COMPONENT NAME</p>
  
  <pre><code>module: shell
  </code></pre>
  
  <p>A sample task looks like below :</p>
  
  <pre><code>- name: MongoDB Auth check
    script: files/mongoAuthCheck.sh
    register: mongoAuthCheck_out
    changed_when: false
  
  - debug:
     msg: "{{ mongoAuthCheck_out.stdout_lines }}"
  </code></pre>
  
  <p>CONFIGURATION</p>
  
  <pre><code>ANSIBLE_NOCOWS(xx/xx/xx/ansible.cfg) = True
  CACHE_PLUGIN(xx/xx/xx/ansible.cfg) = jsonfile
  DEFAULT_GATHERING(xx/xx/xx/ansible.cfg) = smart
  DEFAULT_STDOUT_CALLBACK(xx/xx/xx/ansible.cfg) = json
  HOST_KEY_CHECKING(xx/xx/xx/ansible.cfg) = False
  RETRY_FILES_ENABLED(/xx/xx/xx/ansible.cfg) = False
  </code></pre>
  
  <p>EXPECTED RESULTS</p>
  
  <pre><code>"tasks": [
                  {
                      "hosts": {
                          "10.140.0.15": {
                              "_ansible_no_log": false, 
                              "_ansible_verbose_always": true, 
                              "changed": false, 
                              "msg": [
                                  "Unit mongod.service could not be found.", 
                                  "[INFO] Mongo service not running"
                              ]
                          }, 
                          "10.140.0.18": {
                              "_ansible_no_log": false, 
                              "_ansible_verbose_always": true, 
                              "changed": false, 
                              "msg": [
                                  "Failed global initialization: BadValue Invalid or no user locale set.  Please ensure LANG and/or LC_* environment variables are set correctly. locale::facet::_S_create_c_locale name not valid", 
                                  "[VULNERABLE] MongoDB auth is NOT enabled"
                              ]
                          }, 
                          "10.140.0.22": {
                              "_ansible_no_log": false, 
                              "_ansible_verbose_always": true, 
                              "changed": false, 
                              "msg": [
                                  "[INFO] Mongo service not running"
                              ]
                          }
                      }, 
                      "task": {
                          "id": "d6002031-f201-2ec3-be9f-000000000026", 
                          "name": ""
                      }
                  }
              ]
          }
  </code></pre>
  
  <p>ACTUAL RESULTS</p>
  
  <pre><code>"tasks": [
                  {
                      "hosts": {
                          "10.140.0.15": {
                              "_ansible_no_log": false, 
                              "changed": false, 
                              "rc": 0, 
                              "stderr": "Shared connection to 10.140.0.15 closed.\r\n", 
                              "stdout": "Unit mongod.service could not be found.\r\n[INFO] Mongo service not running\r\n", 
                              "stdout_lines": [
                                  "Unit mongod.service could not be found.", 
                                  "[INFO] Mongo service not running"
                              ]
                          }, 
                          "10.140.0.18": {
                              "_ansible_no_log": false, 
                              "changed": false, 
                              "rc": 0, 
                              "stderr": "Shared connection to 10.140.0.18 closed.\r\n", 
                              "stdout": "Failed global initialization: BadValue Invalid or no user locale set.  Please ensure LANG and/or LC_* environment variables are set correctly. locale::facet::_S_create_c_locale name not valid\r\n[VULNERABLE] MongoDB auth is NOT enabled\r\n", 
                              "stdout_lines": [
                                  "Failed global initialization: BadValue Invalid or no user locale set.  Please ensure LANG and/or LC_* environment variables are set correctly. locale::facet::_S_create_c_locale name not valid", 
                                  "[VULNERABLE] MongoDB auth is NOT enabled"
                              ]
                          }, 
                          "10.140.0.22": {
                              "_ansible_no_log": false, 
                              "changed": false, 
                              "rc": 0, 
                              "stderr": "Shared connection to 10.140.0.22 closed.\r\n", 
                              "stdout": "[INFO] Mongo service not running\r\n", 
                              "stdout_lines": [
                                  "[INFO] Mongo service not running"
                              ]
                          }
                      }, 
                      "task": {
                          "id": "d6002031-f201-2ec3-be9f-000000000025", 
                          "name": "MongoDB Auth check"
                      }
                  }, 
                  {
                      "hosts": {
                          "10.140.0.15": {
                              "_ansible_no_log": false, 
                              "_ansible_verbose_always": true, 
                              "changed": false, 
                              "msg": [
                                  "Unit mongod.service could not be found.", 
                                  "[INFO] Mongo service not running"
                              ]
                          }, 
                          "10.140.0.18": {
                              "_ansible_no_log": false, 
                              "_ansible_verbose_always": true, 
                              "changed": false, 
                              "msg": [
                                  "Failed global initialization: BadValue Invalid or no user locale set.  Please ensure LANG and/or LC_* environment variables are set correctly. locale::facet::_S_create_c_locale name not valid", 
                                  "[VULNERABLE] MongoDB auth is NOT enabled"
                              ]
                          }, 
                          "10.140.0.22": {
                              "_ansible_no_log": false, 
                              "_ansible_verbose_always": true, 
                              "changed": false, 
                              "msg": [
                                  "[INFO] Mongo service not running"
                              ]
                          }
                      }, 
                      "task": {
                          "id": "d6002031-f201-2ec3-be9f-000000000026", 
                          "name": ""
                      }
                  }
              ]
          }
  </code></pre>
  
  <p>How do I get the expected output ?</p>