Courseiva

EX294 Transform data with filters and plugins Practice Question

A playbook reads a JSON file on the control node with the `file` lookup and registers the content as a string named `raw_config`. A task must convert that string into a native Python dictionary so later tasks can reference keys such as `raw_config.database.port`. Which filter should be applied to the registered content?

⚠ Common exam trap

The trap here is assuming a lookup returns structured data rather than a string, so candidates reach for serialization filters instead of a parser.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

from_json

The registered content is a string because the lookup returns file contents verbatim. To use nested keys, that string must be parsed into Ansible's native data structures. The `from_json` filter performs exactly this deserialization, turning a JSON object string into a dictionary that supports dotted access. The reverse filter or YAML-specific parsers would not produce the required dictionary from a JSON string.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    from_json

    Why this is correct

    The `from_json` filter deserializes a JSON-formatted string into the native data structure Ansible uses, so a string containing an object becomes a dictionary whose keys can be addressed with dotted notation. Because the lookup returned text rather than structured data, this conversion is exactly what allows `raw_config.database.port` to resolve in later tasks.

  • ✗

    combine

    Why it's wrong here

    The `combine` filter merges two dictionaries into one, it does not parse text. Since the registered value is still a string, `combine` would fail because it expects dictionary operands. This filter is useful for overlaying configuration hashes but cannot convert the JSON string into the dictionary the scenario requires.

  • ✗

    from_yaml

    Why it's wrong here

    The `from_yaml` filter parses YAML-formatted text, not JSON. Although YAML is a superset in many practical cases, the deliberate use of a JSON document makes `from_yaml` the wrong semantic choice and it can misparse edge cases such as tabs or JSON-specific escapes. The task explicitly requires JSON parsing, so this filter does not match the data format.

  • ✗

    to_json

    Why it's wrong here

    The `to_json` filter performs the opposite transformation: it serializes an existing variable into a JSON string. Applying it to the registered string would produce a quoted, escaped string rather than a dictionary, so dotted lookups like `raw_config.database.port` would still fail and the value would remain unusable as structured data.

About these practice questions

One of 392 original EX294 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Red Hat exam blueprint

This EX294 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX294 exam.