I wouldn't recommend handcrafting json. Have a look at the to_json and to_nice_json filters:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_filters.html#filters-for-formatting-data Dick On Fri, 29 Mar 2019 at 16:07, Saranya N <[email protected]> wrote: > > I was able to convert a list of yaml to Json format. > > The below is my yaml. > > Listofstrings: > - s1 > - S2 > Etc > > > {% for in in listofstrings %} > { Stringslist : [ > { String : " { i } " }, > ] > {% end %} > > So how do I remove the last comma in my json file to ensure proper Json > format. > > The Q's may sound naive but any help is greatly appreciated. > > -- > 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/c062ba83-6fc4-4e80-8d50-2d7e504c42e3%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- Dick Visser Trust & Identity Service Operations Manager GÉANT -- 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/CAL8fbwNoQBvT1_ZVDaiYpTGRDN4BR4-6rKuSb__eWxjw07j0uQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
