Dynamic Structure for JSON

Hello Community,

Need your help in a problem statement

I am passing a API response which is JSON text to a new extension I am working on, But that response can be different in multiple scenarios.

In extension studio we need to define a certain static structure.

My goal is to return a dynamic structure back to OS for user to map user created structure to fields of API


Any solution guys?

Thanks,

Krunal

mvp_badge
MVP

Hi Krunal,

Unfortunately this is not possible. If you need structured data inside an Extension without knowing on forehand what Structure is passed, you need to cast, when calling the Extension Action from a Module, the Structure or List of Strucutures to an Object (using the built-in ToObject Function), and use relection inside the Extension to retrieve the Attributes.

The other way around is not possible: once something's an Object it stays an Object, so you cannot pass a "dynamic" Structure back from an Extension.

It depends a bit on what you want to achieve exactly what the best course of action would be here, so I can't advise you of I don't know more of the details.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.