Search code examples
pythonflaskjinja2

Base64 Decode String in jinja


I'm new to using python and flask and really like it. I'm returning a query to be displayed in a jinja template and one of my columns being returned has base64 data. How do I decode that data and display it.


Solution

  • In jinja To work with Base64 encoded strings:

    {{ encoded | b64decode }}
    {{ decoded | b64encode }}
    

    For more http://docs.ansible.com/ansible/playbooks_filters.html