# Inject JSON file using URI

**URL:** <https://forum.ansible.com/t/inject-json-file-using-uri/33176>\
**Category:** Ansible Project\
**Created:** [June 14, 2020, 6:22pm UTC](https://forum.ansible.com/t/inject-json-file-using-uri/33176 "2020-06-14T18:22:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![renato.marcandier](https://avatars.discourse-cdn.com/v4/letter/r/b77776/32.png) [@renato.marcandier](https://forum.ansible.com/u/renato.marcandier)\
**Post date:** [June 14, 2020, 6:22pm UTC](https://forum.ansible.com/t/inject-json-file-using-uri/33176/1 "2020-06-14T18:22:35Z")

</div>

hey guys,

I need to inject a .json file into an application using ansible.  
I know that we have a module called URI. However this application accepts only by Content-Type: “application/x-www-form-urlencoded” … in this case, I can’t use “src:file.json” Is that correct? …

Do I need to create a variable file with all data and pass it using “body: {{ fields }}”?

Thank you

Regards  
RG

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [June 14, 2020, 6:33pm UTC](https://forum.ansible.com/t/inject-json-file-using-uri/33176/2 "2020-06-14T18:33:22Z")

</div>

> hey guys,
> 
> I need to inject a .json file into an application using ansible.  
> I know that we have a module called URI. However this application accepts only by Content-Type: "application/x-www-form-urlencoded" ... in this case, I can't use "src:file.json" Is that correct? ..

Not sure - but what combination(s) did you try, and what was the outcome?

> Do I need to create a variable file with all data and pass it using "body: {{ fields }}"?

The docs indicate that file uploads should be done using 'src':  
[https://docs.ansible.com/ansible/latest/modules/uri\_module.html#parameter-src](https://docs.ansible.com/ansible/latest/modules/uri_module.html#parameter-src)  
But you can override headers:  
[https://docs.ansible.com/ansible/latest/modules/uri\_module.html#parameter-headers](https://docs.ansible.com/ansible/latest/modules/uri_module.html#parameter-headers)

This combination should do what you want.
