appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
33.83k stars 3.65k forks source link

[Feature] Smart JSON substitution enhancements #3811

Open riodeuno opened 3 years ago

riodeuno commented 3 years ago

Summary

Casting empty values appropriately and automatically can have a high impact when defining JSON payloads. Today, we need to write verbose ternary operations to cast them accordingly.

For example: undefined is considered incorrect in JSON, so we should have it automatically substituted to null during Smart JSON substitution

A screenshot of how verbose it is for users: smart-substitution

trishaanand commented 3 years ago

@riodeuno @Nikhil-Nandagopal : The real behaviour indeed is to set it to null. When the API executes, smart substitution ensures that null values are set correctly and the JSON sent out is valid. Do you mean that the client should display this ? @hetunandu : Is this possible in smart substitution to handle undefined as null values?

riodeuno commented 3 years ago

@trishaanand Yes. We should try to maintain the accuracy of the displayed evaluated values. If we're executing the API with the values substituted as null we should show this in the evaluated values display.