[ZBX-26289] Preprocessing test strips leading spaces from results Created: 2025 Apr 04  Updated: 2025 Aug 01

Status: Resolved
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 7.2.4
Fix Version/s: 7.0.18rc1, 7.4.2rc1, 8.0.0alpha1 (master)

Type: Problem report Priority: Trivial
Reporter: Matthew Steeves Assignee: Aleksandrs Subins
Resolution: Unresolved Votes: 0
Labels: json, preprocessing, testitem
Remaining Estimate: Not Specified
Time Spent: 5.5h
Original Estimate: Not Specified

Team: Team A
Sprint: S25-W30/31, S25-W32/33
Story Points: 1

 Description   

Steps to reproduce:
1. Create any item that returns JSON string (db.odbc.get[] in my case)
2. Add pre-processing step:
Name: Javascript
Parameters: return JSON.stringify(JSON.parse(value), null, 4)
3. Run "Get Value and Test"

Result:
JSON is formatted but with the leading indentation stripped off.

[
{
"DBEVENT_PROCESS_LOG_ID": "1",
"PROCESS_NAME": "asdf",
"PACKAGE_NAME": "N/A",
...

Expected:
JSON is formatted and includes the leading spaces..

[
    {
        "DBEVENT_PROCESS_LOG_ID": "1",
        "PROCESS_NAME": "asdf",
        "PACKAGE_NAME": "N/A",
...

Important: When the item values are actually collected, the leading spaces are kept. So this behaviour is just experienced when testing preprocessing.



 Comments   
Comment by Alexander Vladishev [ 2025 Apr 04 ]

This appears to be a display issue. The server returns properly formatted JSON, but the value is not shown correctly in the frontend.
I confirm the problem.

Generated at Sat Aug 02 10:25:37 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.