How to extract parts of JSON or XML Output

Hi, after building several workflows i got stuck the first time, after trying to solve the problem alone..

I have, lets say, 2 columns and 2 rows, that look like this:



  STRING JSON
row0 xyz1
{
  "data" : [ {
     "outputs" : [ {
         "hash" : "xyz1",
         "hash" : "xyz2",
     } ],
     "outputs" : [ {
         "hash" : "xyz3",
         "hash" : "xyz4",
         "hash" : "xyz5",
     } ],
}
row1 abc4
{
  "data" : [ {
     "outputs" : [ {
         "hash" : "abc1",
         "hash" : "abc2",
     } ],
     "outputs" : [ {
         "hash" : "abc3",
         "hash" : "abc4",
         "hash" : "abc5",
     } ],
		<pre class="brush:python;">
 &quot;outputs&quot; : [ {
     &quot;hash&quot; : &quot;abc6&quot;,
     &quot;hash&quot; : &quot;abc4&quot;,
     &quot;hash&quot; : &quot;abc6&quot;,
 } ],</pre>

		<pre class="brush:python;">

}

 

Now i want to extract all "outputs" data, that contain the string value from the other column, which should look like this:


  STRING JSON RESULT
row0 xyz1
{
  "data" : [ {
     "outputs" : [ {
         "hash" : "xyz1",
         "hash" : "xyz2",
     } ],
     "outputs" : [ {
         "hash" : "xyz3",
         "hash" : "xyz4",
         "hash" : "xyz5",
     } ],
}
     "outputs" : [ {
         "hash" : "xyz1",
         "hash" : "xyz2",
     } ],
row1 abc4
{
  "data" : [ {
     "outputs" : [ {
         "hash" : "abc1",
         "hash" : "abc2",
     } ],
     "outputs" : [ {
         "hash" : "abc3",
         "hash" : "abc4",
         "hash" : "abc5",
     } ],
		<pre class="brush:python;">
 &quot;outputs&quot; : [ {
     &quot;hash&quot; : &quot;abc6&quot;,
     &quot;hash&quot; : &quot;abc4&quot;,
     &quot;hash&quot; : &quot;abc6&quot;,
 } ],</pre>

		<pre class="brush:python;">

}



“outputs” : [ {
“hash” : “abc3”,
“hash” : “abc4”,
“hash” : “abc5”,
} ],
		<pre class="brush:python;">
 &quot;outputs&quot; : [ {
     &quot;hash&quot; : &quot;abc6&quot;,
     &quot;hash&quot; : &quot;abc4&quot;,
     &quot;hash&quot; : &quot;abc6&quot;,
 } ],</pre>
		</td>
	</tr>
</tbody>

Has anybody an idea how to solve this?

Thank you very much in advance.

I think this question is duplicate ?

https://tech.knime.org/forum/knime-general/how-to-extract-something-from-json-data