From 01b0a73ab64b3244310e5799ec2846d09485e4d3 Mon Sep 17 00:00:00 2001 From: Sterling Shi <156466823+SterlingT3485@users.noreply.github.com> Date: Tue, 17 Dec 2024 16:16:34 -0500 Subject: [PATCH] Trim Unnecessary Quote for CLI JSON output (#4643) --- tools/shell/embedded_shell.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/shell/embedded_shell.cpp b/tools/shell/embedded_shell.cpp index 438c15277cc..ba23927cf4a 100644 --- a/tools/shell/embedded_shell.cpp +++ b/tools/shell/embedded_shell.cpp @@ -844,9 +844,16 @@ std::string EmbeddedShell::printJsonExecutionResult(QueryResult& queryResult) co printString += escapeJsonString(colNames[i]); printString += jsonDrawingCharacters->KeyValue; printString += jsonDrawingCharacters->KeyDelimiter; - printString += jsonDrawingCharacters->KeyValue; + auto valueTypeID = tuple->getValue(i)->getDataType().getLogicalTypeID(); + if (valueTypeID == common::LogicalTypeID::STRING || + valueTypeID == common::LogicalTypeID::BLOB) { + printString += jsonDrawingCharacters->KeyValue; + } printString += escapeJsonString(tuple->getValue(i)->toString()); - printString += jsonDrawingCharacters->KeyValue; + if (valueTypeID == common::LogicalTypeID::STRING || + valueTypeID == common::LogicalTypeID::BLOB) { + printString += jsonDrawingCharacters->KeyValue; + } if (i != queryResult.getNumColumns() - 1) { printString += jsonDrawingCharacters->TupleDelimiter; }