# Using 'jc' parser in 'ansible.utils.cli\_parse' module

**URL:** <https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999>\
**Category:** Get Help\
**Created:** [February 3, 2025, 11:25am UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999 "2025-02-03T11:25:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [February 3, 2025, 11:25am UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999/1 "2025-02-03T11:25:26Z")

</div>

I’d like to use the ‘jc’ parser in the module ‘ansible.utils.cli\_parse’ but I cannot figure out to set the jc specific parser in the module parameter. When I try the following …

```auto
    - ansible.utils.cli_parse:
        command: ps
        parser:
          name: community.general.jc
          vars:
            parser: ps
        set_fact: _ps_output

```

… I get the error `fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error loading parser: No module named 'ansible_collections.community.general.plugins.sub_plugins'"}`

I believe that ‘jc’ is functioning otherwise as that below provides a nice JSON list of dicts.

```auto
    - ansible.builtin.command: ps
      register: _ps_output

    - ansible.builtin.debug:
        msg: "{{ _ps_output.stdout | community.general.jc('ps') }}"

```

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [February 3, 2025, 1:05pm UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999/2 "2025-02-03T13:05:20Z")

</div>

`community.general.jc` is a filter plugin, not a sub-plugin for the `ansible.utils.cli_parse` module. So you cannot use it with `ansible.utils.cli_parse`, unfortunately.

---

<div class="post-metadata">

**Author:** ![iamroddo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/iamroddo/32/321_2.png) [@iamroddo](https://forum.ansible.com/u/iamroddo)\
**Post date:** [February 4, 2025, 4:16am UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999/3 "2025-02-04T04:16:27Z")

</div>

Thanks for the clarification. The [cli\_parse docs](https://docs.ansible.com/ansible/latest/collections/ansible/utils/cli_parse_module.html) are not exactly clear what sub-plugins are supported, though on a re-read, there is no reference to `jc`. However in the more general docs on cli parsing under the [section](https://docs.ansible.com/ansible/latest/network/user_guide/cli_parsing.html#parsing-the-cli) on the `cli_parse` module, `jc` is specifically mentioned as being supported with the that module, is this a different thing, or an error in the docs?

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [February 4, 2025, 6:57am UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999/4 "2025-02-04T06:57:39Z")

</div>

Hmm, that was added in [Add JC filter plugin example by kellyjonbrazil · Pull Request #74563 · ansible/ansible · GitHub](https://github.com/ansible/ansible/pull/74563), but I think that PR was wrong and it should never have been added to that section.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [February 4, 2025, 7:00am UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999/5 "2025-02-04T07:00:28Z")

</div>

I’ve created a PR to remove it from that section: [Remove incorrect parts from docs by felixfontein · Pull Request #2388 · ansible/ansible-documentation · GitHub](https://github.com/ansible/ansible-documentation/pull/2388)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 6, 2025, 7:01am UTC](https://forum.ansible.com/t/using-jc-parser-in-ansible-utils-cli-parse-module/39999/6 "2025-03-06T07:01:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
