Reranko05 commented on code in PR #50877:
URL: https://github.com/apache/arrow/pull/50877#discussion_r3789791713


##########
cpp/src/parquet/types.cc:
##########
@@ -1171,10 +1174,16 @@ std::string LogicalType::Impl::Decimal::ToString() 
const {
 }
 
 std::string LogicalType::Impl::Decimal::ToJSON() const {
-  std::stringstream json;
-  json << R"({"Type": "Decimal", "precision": )" << precision_ << R"(, 
"scale": )"
-       << scale_ << "}";
-  return json.str();
+  ::arrow::json::JsonWriter writer;
+  writer.StartObject();
+  writer.StringField("Type", "Decimal");
+  writer.Key("precision");
+  writer.Int(precision_);
+  writer.Key("scale");

Review Comment:
   Could we add an `IntField()` helper to `JsonWriter` and use it here, similar 
to `StringField()` and `BoolField()`? It would make these conversions a bit 
cleaner.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to