Converting a multi-lines string into a list

A call to ansible uri module returns a multi-line string:

`

  • set_fact:
    fact: “{{ return_uri_json.body }}”

ok: [target] => {
“ansible_facts”: {
“fact”: “line_1\nline_2\nline_3\nline_4\n”
},
“changed”: false
}

`

The goal is to convert “fact” into:
`

  • “line_1”
  • “line_2”
  • “line_3”
  • “line_4”

`

I couldn’t find any jinja2 filter for that task. Maybe I’ve missed something.
Any suggestion?

You can use Python splitlines

{{ return_uri_json.body.splitlines() }}

Using a python string method on an ansible variable: brilliant!