Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jinja fromjson custom filter #2378

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

delenamalan
Copy link

@delenamalan delenamalan commented May 19, 2024

Add a custom Jinja2 filter, fromjson, to convert a JSON string to JSON - which can then be used by Jinja.

This is useful for formatting notifications based on JSON API responses.

If the API route you're watching returns a JSON list, for example, you could format a notification like this:

<ul>
{% for item in current_snapshot %}
  <li>{{ item.title}}: {{ item.price }}</li>
{% endfor %}
</ul>

@dgtlmoon
Copy link
Owner

dgtlmoon commented May 20, 2024

Can you give some (any) information here? whats your use case exactly?

any examples??

@delenamalan
Copy link
Author

@dgtlmoon sure, I added a description and example to the PR description now.

The PR is still in draft because I'd still like to add a test and update the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants