Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This solution provides a significant User Experience (UX) enhancement for fields that store complex data in JSON format (e.g., integration payloads, configuration properties, or setup data).

Instead of forcing users (developers, administrators) to read or edit raw, unformatted JSON in a plain text area, this macro adds a "JSON Viewer" button next to the field

Name json_formatter_macro
Active true
Type XML

Navigate to **System UI > UI** Macros and create a new record named json_formatter_macro , Use XML Attached File as Script
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="jelly:html" xmlns:g2="glide.ui">

<g:evaluate var="jvar_field_name" expression="RP.getWindowProperties().get('fieldName')" />

<button type="button"
onclick="openJsonViewer('${jvar_field_name}');"
title="View and Format JSON"
class="btn btn-default btn-sm">
<span class="icon-code"></span> JSON Viewer
</button>

<script>
function openJsonViewer(fieldName) {
var jsonValue = g_form.getValue(fieldName);
var gm = new GlideModal('json_viewer_ui_page', false); // Replace 'json_viewer_ui_page' with your actual UI Page or Widget ID
gm.setTitle('JSON Data Viewer & Formatter for Field: ' + fieldName);
gm.setPreference('json_data', jsonValue);
gm.setSize(900);
gm.render();
}
</script>
</j:jelly>
Loading