Using expression libraries in JSON Generator

Hello,

I need to generate a JSON with a bunch of dynamic keys, which are stored in an expression library. I haven’t found a well rounded solution so far, except pushing it all together in a single mapper field, however i was hoping to find something more graceful and readable.

So my idea was to use a JSON Generator and piece together the information, however I run into two issues:

  • How can I access the expression libraries in a JSON Generator?
  • How can I set the values of the expression library as element key?

I’ve tried several combinations to achieve the first thing:

[
    {
        "test" : $lib.env.jiraSyncDatefield[pipe.plexPath.split('/')[1]]
    }
]

[
    {
        "test" : ${lib.env.jiraSyncDatefield[pipe.plexPath.split('/')[1]]}
    }
]

Once I have this working, the question arises on how i can set these values as element keys, I hope that will be working by enclosing them in square brackets.

Did anyone have a similar task in the past?

EDIT: Found a simpler approach, i wasn’t aware that the expression evaluation worked in the target path:

Still, it would be good to know if the described use case is possible.

Best regards
Thomas