Hi

It's working fine. Thanks a lot.

Den onsdag den 14. maj 2014 17.35.45 UTC+2 skrev James Cammarata:
>
> Use "{{ jsonformat|to_json }}" to force the format to json.
>
> Sample test:
>
> - hosts: localhost
>   gather_facts: no
>   vars:
>     foo: '{"a": [1,2,"3"]}'
>   tasks:
>   - shell: echo "{{ foo|to_json }}" > /tmp/output
>
> After running: 
>
> $ cat /tmp/output:
> {"a": [1,2,"3"]}
>
>
>
> On Wed, May 14, 2014 at 8:58 AM, Khuong Dinh Pham 
> <[email protected]<javascript:>
> > wrote:
>
>> Hi
>>
>> I have this:
>>
>>   - some_action: ....
>>     register: jsonformat
>>   - debug: var=jsonformat
>>   - local_action: shell echo {{ jsonformat }} > output
>>
>>
>> The json in console is displayed fine from debug action but the output 
>> file is not a valid json. It has some escape and unicode values. How can i 
>> output a valid json document to a file from a variable?
>>
>> thx in advance.
>>
>> -- 
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/0ea3e3d2-61bd-4bee-8602-7da9c41e865d%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/0ea3e3d2-61bd-4bee-8602-7da9c41e865d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/ee37c80d-f40f-4de6-bf10-85bf6d877f3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to