aboutsummaryrefslogtreecommitdiffstats
path: root/solc/jsonCompiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'solc/jsonCompiler.cpp')
-rw-r--r--solc/jsonCompiler.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp
index e5be8404..52f796a5 100644
--- a/solc/jsonCompiler.cpp
+++ b/solc/jsonCompiler.cpp
@@ -125,6 +125,13 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
return gasEstimates;
}
+string jsonCompactPrint(Json::Value const& input)
+{
+ Json::FastWriter writer;
+ writer.omitEndingLineFeed();
+ return writer.write(input);
+}
+
string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback _readCallback)
{
Json::Value output(Json::objectValue);
@@ -213,7 +220,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
for (string const& contractName: compiler.contractNames())
{
Json::Value contractData(Json::objectValue);
- contractData["interface"] = compiler.interface(contractName);
+ contractData["interface"] = jsonCompactPrint(compiler.interface(contractName));
contractData["bytecode"] = compiler.object(contractName).toHex();
contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex();
contractData["opcodes"] = solidity::disassemble(compiler.object(contractName).bytecode);
@@ -274,7 +281,7 @@ string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback
try
{
- return Json::FastWriter().write(output);
+ return jsonCompactPrint(output);
}
catch (...)
{
@@ -292,7 +299,7 @@ string compileMulti(string const& _input, bool _optimize, CStyleReadFileCallback
errors.append("Error parsing input JSON: " + reader.getFormattedErrorMessages());
Json::Value output(Json::objectValue);
output["errors"] = errors;
- return Json::FastWriter().write(output);
+ return jsonCompactPrint(output);
}
else
{