Parsing Json with dynamic Keys

Hi @sudheerkopparapu,

First of all, the JSON file you have provided has an extra comma at line 189.

There was a similar topic like this, where some manipulation on an XML was needed to transform keys (element names) to values:

So I followed the same idea to manipulate the JSON using the String Manipulation node and this expression:

regexReplace(regexReplace($json$, "\"(\\d[^\"]+)\"", "\"item\":\"$1\",\n\"item2\""), "([-\\d.]+)", "$1")

And then by using 3 JSON Path nodes, I extracted each level separately passing the sub-level as json to the next JSON Path node.
Here is the workflow:
22342-1-1.knwf (45.3 KB)

:blush:

2 Likes