{% for category, message in get_flashed_messages(with_categories=true) %} {% endfor %}

Preview json

Output of main program

Output of data-saving script