Join the Webstudio community

Updated 2 weeks ago

Simple Data Transformation in Expression Editor

I’m not sure if this functionality already exists, but it would be great to have simple data transformation options in the expression editor. This would make it easier to work with existing backends.

For example, with the new global variables feature, I’m using GraphQL to fetch site settings from Headless WordPress. However, the language/locale is returned as en_AU, whereas Webstudio expects en-AU.

I tried using the following expression to transform the format:
siteSettings.data.data.allSettings.generalSettingsLanguage.replace('_', '-')

Would it be possible to support transformations like this directly within the expression editor?
B
1 comment
Not at the moment. Methods are disabled for security reasons.
Add a reply
Sign up and join the conversation on Discord