particledecay / ansible-jsonpatch

An Ansible module for patching JSON files
MIT License
118 stars 27 forks source link

Add option to pretty-print the output JSON file #1

Closed fabiocaseri closed 5 years ago

fabiocaseri commented 5 years ago

If the file exists and it's not pretty-printed, it will be pretty-printed at the first change.

- name: Add or replace 'baz' member
  jsonpatch:
    src: "test.json"
    pretty: yes
    operations:
      - op: add
        path: "/baz"
        value: "quz"
particledecay commented 5 years ago

I didn't see this PR until now (GH notifications are awful), but this functionality exists in the latest version of the module. Thanks for this anyway, and sorry about that!