Hi,

I have  a json file called "develop.json" like below,

{
    "releasedata": {
        "release_name": "abcd",
        "release_number": "22"
    }
}

I want to read this file in ansible and get the value for "release_name" 
key. I have tried the below code

---
  - hosts: localhost
    vars:
       version_file: "{{ lookup('file', '/opt/develop.json')  | from_json 
}}"
    tasks:
       - name: print json file
        debug: msg= "{{ version_file.releasedata.release_name }}"

But I am getting this error:
 {"failed": true, "msg": "the field 'args' has an invalid value ([]), and 
could not be converted to an dict

So I am assuming this is not the right way to read a json file in ansible. 
Kindly tell me the right way to read a json file. Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2891612b-0a9a-40d7-a0af-24f3012df6ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to