title: Parse bad html file in Ansible as xml
body: <p>I have a response from Confluence with some info. I am replacing specific keys in the JSON response and then doing a PUT request so I can update a page.
  The problem is, I cannot parse the file correctly(by keys) because it is not a valid file (it seems).
  From the whole response, I need to replace only 1 value:</p>
  <pre><code> {
      &quot;cache_control&quot;: &quot;no-store&quot;,
      &quot;changed&quot;: false,
      &quot;connection&quot;: &quot;close&quot;,
      &quot;content&quot;: &quot;{\&quot;id\&quot;:\&quot;164794022\&quot;,\&quot;type\&quot;:\&quot;page\&quot;,\&quot;status\&quot;:\&quot;current\&quot;,\&quot;title\&quot;:\&quot;Jira Dev\&quot;,\&quot;body\&quot;:{\&quot;storage\&quot;:{\&quot;value\&quot;:\&quot;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ac:structured-macro ac:name=\\\&quot;details\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;6f61e6bd-3edc-4e93-a9b7-2f15cd5fc33c\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;id\\\&quot;&gt;1&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;table class=\\\&quot;wrapped\\\&quot;&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Hostname&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;jira-dev&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;IP&lt;/th&gt;&lt;td&gt;192.168.182.231&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Static/Dynamic IP?&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;&lt;div class=\\\&quot;content-wrapper\\\&quot;&gt;&lt;p&gt;&lt;ac:structured-macro ac:name=\\\&quot;status\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;3a801df2-b1e5-4209-88dd-06483f6e368a\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;colour\\\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;Static&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Server&lt;/th&gt;&lt;td&gt;Hosted by IT Team&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;&lt;p&gt;Installed Product&lt;/p&gt;&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;Jira Software + Service Management&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;&lt;p&gt;Necessity&lt;/p&gt;&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;&lt;div class=\\\&quot;content-wrapper\\\&quot;&gt;&lt;p&gt;&lt;ac:structured-macro ac:name=\\\&quot;status\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;9e5e9eba-4648-4599-a052-865aaa3535f7\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;colour\\\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;Normal&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;OS&lt;/th&gt;&lt;td&gt;Ubuntu 20.04&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Monitoring&lt;/th&gt;&lt;td&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Backup&lt;/th&gt;&lt;td&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Installed Product URL&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;&lt;a href=\\\&quot;http://jira-dev:8080\\\&quot;&gt;http://jira-dev:8080&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Using SSO&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Product credentials&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;&lt;div class=\\\&quot;content-wrapper\\\&quot;&gt;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ac:structured-macro ac:name=\\\&quot;secure\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;baba2872-b3b8-45e2-a5b4-fe7384f862d2\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;Product credentials&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;span class=\\\&quot;sec-icon-lock icon16\\\&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;pre class=\\\&quot;secret\\\&quot;&gt;-----BEGIN PGP MESSAGE-----\\nVersion: BCPG v1.59\\n\\nhQEMAxOSOe32i2V3Agf/SGkioVaXxO/pLAdaT6K7+tNBzVdCgmdYz8rIPF2C+fw9\\nY8W+3++H8IyWMVDmSlAV6zENi/YnV9roOJC/ndSHEHEiBAtfHQUjT62cRQM7b3fo\\nwOKhDETne4q42bFEJbfo9TJ+eYhOTJ4GduRJz1yNetgWpAbiVg3rXj7Aox9xeWIe\\nHK1rGm5ZzIElXLI9VpjNvKG0aqVQS4QefcuKi6/xVnZu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zZbH0PKq0vHmShy/J3b\\nK4kT09FF/Wcc3j6f4pSwR1B23p9fNE17iUvcNoU9c+tD3g==\\n=Qwvl\\n-----END PGP MESSAGE-----\\n&lt;/pre&gt;Secured content&lt;/ac:rich-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Host credentials&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;&lt;div class=\\\&quot;content-wrapper\\\&quot;&gt;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ac:structured-macro ac:name=\\\&quot;secure\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;fbc7388c-0965-4b10-8acc-0d1233ca3ef4\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;Host credentials&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;span class=\\\&quot;sec-icon-lock icon16\\\&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;pre class=\\\&quot;secret\\\&quot;&gt;-----BEGIN PGP MESSAGE-----\\nVersion: OpenPGP.js v4.10.10\\nComment: https://openpgpjs.org\\n\\nwcBMAxOSOe32i2V3Agf+IKFt2bSmyFl4Sk3YtTf1cXu+Xv9yZ0c/iP4RJ9ll\\n5P9LM8DKPtBL+othBMLEUigNEgjXOrANp11W/endk1Ulst4UkTyttQQx5JZ2\\nyNI2Q0M5uUfj/2tlCq9TTO1eXb/bffM+cKzk0D68UWC+EBvXpRp5sbKVz1Ya\\nJj7nYItETTuWPUjF0uEaYVlbmsdfe3dvVy63EPw5GZdVobwv++93ZIEEhKmS\\nvc+d+iw9L+Ov16kXCQaHNXzyiwtvp5nIIMYORp3IaRrbzmBqiV07RjIZrvNR\\nyozEGcNWdSW7egC1k+JEF+qi2kLASglKLWFWmHn/cMpetULl8Z9c3VFZpnu7\\nENLBVwFQ2f3uaF+A6t19Zi5CKptV+f1qtYekyZZok61TBkldQD4AL2UEBDB0\\nMpUfEEdy4vgYqNjGWGOpX2QbWjXZDhxPAQgNr6XxxcJ7L1gzHLZT45MjFzB9\\nBBhtX/qvczL1uWNHwYErUZGbwX6pwfyfbTUDX57bDbOYUG0A+nZjWIRJt5tA\\nFPWiM0vicufuMACUYG00n3+C2Eu/DPIcRaHRhnz1aEDOQ4dX19ZpUCY0hWeZ\\ndnhtLEYOXxTy6bgsHoBIHxac+DQ9a/0iFSNIErXfIq7yrABPEfn04Kc3tkXJ\\nK+RAFQ7aJ93LjkfYMqxjLVp1lAZ05dealMLHStkvisPI3Y0qDGwPKmg9kkMD\\nBnF5OuU6L/RXzei9eUHU4O2HOJtf5ClTZ7vHBXyBzoZ1JOUu2axAaOJq7Y8h\\nm7L1vYJngepSMrh4xLzQXuoegM049NNSIsumioCyF4VBvtopATta1cG/U2dF\\n/lahHpm0l3FtdWodNCag2Ejsr61+H5gIHinqPZC96MUmdbOOzWnHXlXjAAO/\\nzkXNDAAJss+WolNuF+o8yUd9w9woYIuqzrXOOMhEM1pAxAiBhOjeXI3lQXa6\\nf0pr/txZXy+qrvuQlcaF5EyWc4GrLTnuceBWAhHIrsaEhLQVf5RtJDrvgdyR\\nJLw4+79Hzt+/R6gRP6Pat1bN9e734/w09gpdvnolzWxTzpn7Wuje4uX4w+M=\\n=CiIl\\n-----END PGP MESSAGE-----\\n&lt;/pre&gt;Secured content&lt;/ac:rich-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\\\&quot;1\\\&quot;&gt;Status&lt;/th&gt;&lt;td colspan=\\\&quot;1\\\&quot;&gt;&lt;div class=\\\&quot;content-wrapper\\\&quot;&gt;&lt;p&gt;&lt;ac:structured-macro ac:name=\\\&quot;status\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;43f14423-450c-483b-9dd6-ef711982db40\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;colour\\\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;PING&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;span&gt; &lt;/span&gt;&lt;ac:structured-macro ac:name=\\\&quot;status\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;1e1a2aa2-80ee-49e9-8f4c-5c5335ac3f52\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;colour\\\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;ssh&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;span&gt; &lt;/span&gt;&lt;ac:structured-macro ac:name=\\\&quot;status\\\&quot; ac:schema-version=\\\&quot;1\\\&quot; ac:macro-id=\\\&quot;68710b0e-2f40-4156-ac81-15f1c3c1d025\\\&quot;&gt;&lt;ac:parameter ac:name=\\\&quot;colour\\\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\\\&quot;title\\\&quot;&gt;HTTP&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p class=\\\&quot;auto-cursor-target\\\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ac:rich-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;\&quot;,\&quot;representation\&quot;:\&quot;storage\&quot;,\&quot;_expandable\&quot;:{\&quot;content\&quot;:\&quot;/rest/api/content/164794022\&quot;}},\&quot;_expandable\&quot;:{\&quot;editor\&quot;:\&quot;\&quot;,\&quot;view\&quot;:\&quot;\&quot;,\&quot;export_view\&quot;:\&quot;\&quot;,\&quot;styled_view\&quot;:\&quot;\&quot;,\&quot;anonymous_export_view\&quot;:\&quot;\&quot;}},\&quot;extensions\&quot;:{\&quot;position\&quot;:\&quot;none\&quot;},\&quot;_links\&quot;:{\&quot;webui\&quot;:\&quot;/display/AT/Jira+Dev\&quot;,\&quot;edit\&quot;:\&quot;/pages/resumedraft.action?draftId=164794022&amp;draftShareId=e44b5ec9-f1a1-463e-aa40-6667c6022ec8\&quot;,\&quot;tinyui\&quot;:\&quot;/x/po7SCQ\&quot;,\&quot;collection\&quot;:\&quot;/rest/api/content\&quot;,\&quot;base\&quot;:\&quot;https://blabla/confluence\&quot;,\&quot;context\&quot;:\&quot;/confluence\&quot;,\&quot;self\&quot;:\&quot;https://blabla/confluence/rest/api/content/164794022\&quot;},\&quot;_expandable\&quot;:{\&quot;container\&quot;:\&quot;/rest/api/space/AT\&quot;,\&quot;metadata\&quot;:\&quot;\&quot;,\&quot;operations\&quot;:\&quot;\&quot;,\&quot;children\&quot;:\&quot;/rest/api/content/164794022/child\&quot;,\&quot;restrictions\&quot;:\&quot;/rest/api/content/164794022/restriction/byOperation\&quot;,\&quot;history\&quot;:\&quot;/rest/api/content/164794022/history\&quot;,\&quot;ancestors\&quot;:\&quot;\&quot;,\&quot;version\&quot;:\&quot;\&quot;,\&quot;descendants\&quot;:\&quot;/rest/api/content/164794022/descendant\&quot;,\&quot;space\&quot;:\&quot;/rest/api/space/AT\&quot;}}&quot;,
      &quot;content_type&quot;: &quot;application/json&quot;,
      &quot;date&quot;: &quot;Fri, 10 Sep 2021 12:11:19 GMT&quot;,
      &quot;elapsed&quot;: 0,
      &quot;expires&quot;: &quot;Thu, 01 Jan 1970 00:00:00 GMT&quot;,
      &quot;failed&quot;: false,
      &quot;json&quot;: {
          &quot;_expandable&quot;: {
              &quot;ancestors&quot;: &quot;&quot;,
              &quot;children&quot;: &quot;/rest/api/content/164794022/child&quot;,
              &quot;container&quot;: &quot;/rest/api/space/AT&quot;,
              &quot;descendants&quot;: &quot;/rest/api/content/164794022/descendant&quot;,
              &quot;history&quot;: &quot;/rest/api/content/164794022/history&quot;,
              &quot;metadata&quot;: &quot;&quot;,
              &quot;operations&quot;: &quot;&quot;,
              &quot;restrictions&quot;: &quot;/rest/api/content/164794022/restriction/byOperation&quot;,
              &quot;space&quot;: &quot;/rest/api/space/AT&quot;,
              &quot;version&quot;: &quot;&quot;
          },
          &quot;_links&quot;: {
              &quot;base&quot;: &quot;https://blabla/confluence&quot;,
              &quot;collection&quot;: &quot;/rest/api/content&quot;,
              &quot;context&quot;: &quot;/confluence&quot;,
              &quot;edit&quot;: &quot;/pages/resumedraft.action?draftId=164794022&amp;draftShareId=e44b5ec9-f1a1-463e-aa40-6667c6022ec8&quot;,
              &quot;self&quot;: &quot;https://blabla/confluence/rest/api/content/164794022&quot;,
              &quot;tinyui&quot;: &quot;/x/po7SCQ&quot;,
              &quot;webui&quot;: &quot;/display/AT/Jira+Dev&quot;
          },
          &quot;body&quot;: {
              &quot;_expandable&quot;: {
                  &quot;anonymous_export_view&quot;: &quot;&quot;,
                  &quot;editor&quot;: &quot;&quot;,
                  &quot;export_view&quot;: &quot;&quot;,
                  &quot;styled_view&quot;: &quot;&quot;,
                  &quot;view&quot;: &quot;&quot;
              },
              &quot;storage&quot;: {
                  &quot;_expandable&quot;: {
                      &quot;content&quot;: &quot;/rest/api/content/164794022&quot;
                  },
                  &quot;representation&quot;: &quot;storage&quot;,
                  &quot;value&quot;: &quot;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ac:structured-macro ac:name=\&quot;details\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;6f61e6bd-3edc-4e93-a9b7-2f15cd5fc33c\&quot;&gt;&lt;ac:parameter ac:name=\&quot;id\&quot;&gt;1&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;table class=\&quot;wrapped\&quot;&gt;&lt;colgroup&gt;&lt;col /&gt;&lt;col /&gt;&lt;/colgroup&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Hostname&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;jira-dev&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;IP&lt;/th&gt;&lt;td&gt;192.168.182.231&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Static/Dynamic IP?&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;&lt;div class=\&quot;content-wrapper\&quot;&gt;&lt;p&gt;&lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;3a801df2-b1e5-4209-88dd-06483f6e368a\&quot;&gt;&lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;Static&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Server&lt;/th&gt;&lt;td&gt;Hosted by IT Team&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;&lt;p&gt;Installed Product&lt;/p&gt;&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;Jira Software + Service Management&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;&lt;p&gt;Necessity&lt;/p&gt;&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;&lt;div class=\&quot;content-wrapper\&quot;&gt;&lt;p&gt;&lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;9e5e9eba-4648-4599-a052-865aaa3535f7\&quot;&gt;&lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;Normal&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;OS&lt;/th&gt;&lt;td&gt;Ubuntu 20.04&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Monitoring&lt;/th&gt;&lt;td&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th&gt;Backup&lt;/th&gt;&lt;td&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Installed Product URL&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;&lt;a href=\&quot;http://jira-dev:8080\&quot;&gt;http://jira-dev:8080&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Using SSO&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;No&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Product credentials&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;&lt;div class=\&quot;content-wrapper\&quot;&gt;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ac:structured-macro ac:name=\&quot;secure\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;baba2872-b3b8-45e2-a5b4-fe7384f862d2\&quot;&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;Product credentials&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;span class=\&quot;sec-icon-lock icon16\&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;pre class=\&quot;secret\&quot;&gt;-----BEGIN PGP MESSAGE-----\nVersion: BCPG v1.59\n\nhQEMAxOSOe32i2V3Agf/SGkioVaXxO/pLAdaT6K7+tNBzVdCgmdYz8rIPF2C+fw9\nY8W+3++H8IyWMVDmSlAV6zENi/YnV9roOJC/ndSHEHEiBAtfHQUjT62cRQM7b3fo\nwOKhDETne4q42bFEJbfo9TJ+eYhOTJ4GduRJz1yNetgWpAbiVg3rXj7Aox9xeWIe\nHK1rGm5ZzIElXLI9VpjNvKG0aqVQS4QefcuKi6/xVnZuFkdA3IGE2yPWJizPAjyt\nlkD7iRi1Ol46b0xPDVsDfpiwQAdpwM2NmOJwbT6mRBqx0gXeKOXIUOUwDdC6biVJ\nLuau6FDgdQru+oVsXnTD2dM+M7yyhJaMtttUJch9btLCEAHlw2panHKUC6iUxbjZ\nLA8c9z3RgSq01G/gxFMvO3hSs6ih13SAdsCz18MIFdaTDU4+6cMR9hSsgF+8qxtY\nl1JEziDFpqQgZZoDv7afZn3+3IdMQ7mwQgqVu+xsckTe66hO8DlRuslyXiU39Mct\nJuUziC3OGD74x2ZhiFXxLgn4XI77TnEc5qUh6imK4xli6Pyz1Jy4RbgzdNunBN2P\n9qMxNO9fgdx5vfVxmGGaGIbvZ3a3dsSr0vi92xUmV1kd7oaUCuNe2Tw55Eb52fsA\nUQQ1WM/NZi31/cWAPyhLx8cTByMc/RjHg+h0UIlo50CBTNUOPE0QgdAXXZzZ17t5\nsvNdEBswMCHmcMIrCEGa0kWvykgK0D7kvmu+U5yzMM9482K2rws+1Q8e5UHyJ55e\nKn4cUR5yjnBXGZwerSBrIKhUcpGFPCDgctFpV6U8KxrY/lDV7k8TtsV9f71i3o51\noEvV/v9ufoWsFsp5qJRSwY/qkfYAOr8pw5mHFN3pC2MOOkkj1xDOkEwr4/J1wDaI\n8VAGONGizwDnNvYD58LpaAYnQWkdI2WEVLpkKQWgGolJSuDkmpY2wWiSxcAFI31X\nQY1e3nFzXQPcB6MkCW0P1buMUrJnQaVFQmtPf4A/yhmdK15jHfPLbUyIB1j6ewIm\njEDfo276k+nAdskmUNo+0KekJta8RHCS9tR5H4qr4LLiUOmhPYTN7MyDC+aCXX+N\nLtNpnMCQVHVxWTuCCqhmlI1VIOjUOJjAvNKX1+DAhSOquo2FXPeo0nS/MYFeRu/c\npmu5WUR5DI2kZb/psp1Lj+awRvoOy3EV5Tv9a7MfrebvjnV021+JbK2uQVViFtvg\nGAKu8dPDUW0u0jxLWeFxm/RXzcStyS2+CQQ3UY1gdqvenzZbH0PKq0vHmShy/J3b\nK4kT09FF/Wcc3j6f4pSwR1B23p9fNE17iUvcNoU9c+tD3g==\n=Qwvl\n-----END PGP MESSAGE-----\n&lt;/pre&gt;Secured content&lt;/ac:rich-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Host credentials&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;&lt;div class=\&quot;content-wrapper\&quot;&gt;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;ac:structured-macro ac:name=\&quot;secure\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;fbc7388c-0965-4b10-8acc-0d1233ca3ef4\&quot;&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;Host credentials&lt;/ac:parameter&gt;&lt;ac:rich-text-body&gt;&lt;span class=\&quot;sec-icon-lock icon16\&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;pre class=\&quot;secret\&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uQlcaF5EyWc4GrLTnuceBWAhHIrsaEhLQVf5RtJDrvgdyR\nJLw4+79Hzt+/R6gRP6Pat1bN9e734/w09gpdvnolzWxTzpn7Wuje4uX4w+M=\n=CiIl\n-----END PGP MESSAGE-----\n&lt;/pre&gt;Secured content&lt;/ac:rich-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;th colspan=\&quot;1\&quot;&gt;Status&lt;/th&gt;&lt;td colspan=\&quot;1\&quot;&gt;&lt;div class=\&quot;content-wrapper\&quot;&gt;&lt;p&gt;&lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;43f14423-450c-483b-9dd6-ef711982db40\&quot;&gt;&lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;PING&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;span&gt; &lt;/span&gt;&lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;1e1a2aa2-80ee-49e9-8f4c-5c5335ac3f52\&quot;&gt;&lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;ssh&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;span&gt; &lt;/span&gt;&lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;68710b0e-2f40-4156-ac81-15f1c3c1d025\&quot;&gt;&lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;&lt;ac:parameter ac:name=\&quot;title\&quot;&gt;HTTP&lt;/ac:parameter&gt;&lt;/ac:structured-macro&gt;&lt;/p&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p class=\&quot;auto-cursor-target\&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/ac:rich-text-body&gt;&lt;/ac:structured-macro&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&quot;
              }
          },
          &quot;extensions&quot;: {
              &quot;position&quot;: &quot;none&quot;
          },
          &quot;id&quot;: &quot;164794022&quot;,
          &quot;status&quot;: &quot;current&quot;,
          &quot;title&quot;: &quot;Jira Dev&quot;,
          &quot;type&quot;: &quot;page&quot;
      },
      &quot;msg&quot;: &quot;OK (unknown bytes)&quot;,
      &quot;redirected&quot;: false,
      &quot;server&quot;: &quot;Apache/2.4.25 (Debian)&quot;,
      &quot;set_cookie&quot;: &quot;JSESSIONID=5F873F9123B67BA41F1C348D4BB49C92; Path=/confluence; HttpOnly&quot;,
      &quot;status&quot;: 200,
      &quot;transfer_encoding&quot;: &quot;chunked&quot;,
      &quot;url&quot;: &quot;https://blabla/confluence/rest/api/content/164794022?expand=body.storage&quot;,
      &quot;x_ausername&quot;: &quot;ansible&quot;,
      &quot;x_content_type_options&quot;: &quot;nosniff&quot;,
      &quot;x_seraph_loginreason&quot;: &quot;OK&quot;
  }
  
  </code></pre>
  <p>The key i need is :
  <code>json.body.storage.value</code></p>
  <p>The actual value is an HTML document. I tried parsing it as xml but it is invalid. Also escape characters are in response. They should be there again after edit for the PUT request.
  The subset I need to change is inside the value, in a <code>div</code>. How can I parse, compare and change the values of <code>color</code> depending on <code>title</code>. Is there an easy way to parse? Values will be changed only if different from actual values. This is why I need to compare them.</p>
  <pre><code>&lt;div class=\&quot;content-wrapper\&quot;&gt;
                    &lt;p&gt;
                      &lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;43f14423-450c-483b-9dd6-ef711982db40\&quot;&gt;
                        &lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;
                        &lt;ac:parameter ac:name=\&quot;title\&quot;&gt;PING&lt;/ac:parameter&gt;
                      &lt;/ac:structured-macro&gt;
                      &lt;span&gt;
                      &lt;/span&gt;
                      &lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;1e1a2aa2-80ee-49e9-8f4c-5c5335ac3f52\&quot;&gt;
                        &lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;
                        &lt;ac:parameter ac:name=\&quot;title\&quot;&gt;ssh&lt;/ac:parameter&gt;
                      &lt;/ac:structured-macro&gt;
                      &lt;span&gt;
                      &lt;/span&gt;
                      &lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;68710b0e-2f40-4156-ac81-15f1c3c1d025\&quot;&gt;
                        &lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Green&lt;/ac:parameter&gt;
                        &lt;ac:parameter ac:name=\&quot;title\&quot;&gt;HTTP&lt;/ac:parameter&gt;
                      &lt;/ac:structured-macro&gt;
                    &lt;/p&gt;
                  &lt;/div&gt;
  </code></pre>
  <p>I just need the original page with 3 words edited (again in original <code>JSON</code> format). I need the original JSON with</p>
  <pre><code>&lt;div class=\&quot;content-wrapper\&quot;&gt;
                    &lt;p&gt;
                      &lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;43f14423-450c-483b-9dd6-ef711982db40\&quot;&gt;
                        &lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Red&lt;/ac:parameter&gt;
                        &lt;ac:parameter ac:name=\&quot;title\&quot;&gt;PING&lt;/ac:parameter&gt;
                      &lt;/ac:structured-macro&gt;
                      &lt;span&gt;
                      &lt;/span&gt;
                      &lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;1e1a2aa2-80ee-49e9-8f4c-5c5335ac3f52\&quot;&gt;
                        &lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Red&lt;/ac:parameter&gt;
                        &lt;ac:parameter ac:name=\&quot;title\&quot;&gt;ssh&lt;/ac:parameter&gt;
                      &lt;/ac:structured-macro&gt;
                      &lt;span&gt;
                      &lt;/span&gt;
                      &lt;ac:structured-macro ac:name=\&quot;status\&quot; ac:schema-version=\&quot;1\&quot; ac:macro-id=\&quot;68710b0e-2f40-4156-ac81-15f1c3c1d025\&quot;&gt;
                        &lt;ac:parameter ac:name=\&quot;colour\&quot;&gt;Red&lt;/ac:parameter&gt;
                        &lt;ac:parameter ac:name=\&quot;title\&quot;&gt;HTTP&lt;/ac:parameter&gt;
                      &lt;/ac:structured-macro&gt;
                    &lt;/p&gt;
                  &lt;/div&gt;
  </code></pre>