Search code examples
jsonpentahokettle

How to get json keys in Pentaho?


I am trying to get the json keys in Pentaho. This is my json:

 {"ID":0,"Landen":"T001047","GN":"GN25010010","Perioden":"2015JJ00","TotaleInvoerwaarde_1":"       2","TotaleInvoerhoeveelheid_2":"       2","TotaleUitvoerwaarde_3":"       1","TotaleUitvoerhoeveelheid_4":"       1","EenheidHoeveelheid_5":"mln kg                   "}

Altough you can use a modified Javascript value to get the keys. It doesn't give the keys one by one so it doesn't loop correctely. So is there another way to get the json keys?


Solution

  • Just split the values on "," to get one key-value pair per records, and then remove everything after : and remove doublequotes, "{" and "}", and you are there.... Just basic transformation steps.

    Result: Result

    Details: Details