diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 74c273c1f..6a2e5c948 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -2416,6 +2416,9 @@
True
+
+ True
+
@@ -2430,6 +2433,8 @@
+
+
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index e06a87b7c..3fe0bc9fb 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -3429,6 +3429,9 @@
ripple\json\impl
+
+ ripple\json\impl
+
ripple\json
@@ -3450,6 +3453,9 @@
ripple\json
+
+ ripple\json
+
ripple\net
diff --git a/src/ripple/app/ledger/BookListeners.cpp b/src/ripple/app/ledger/BookListeners.cpp
index 1eb927cc5..da9c3761a 100644
--- a/src/ripple/app/ledger/BookListeners.cpp
+++ b/src/ripple/app/ledger/BookListeners.cpp
@@ -33,8 +33,7 @@ void BookListeners::removeSubscriber (std::uint64_t seq)
void BookListeners::publish (Json::Value const& jvObj)
{
- Json::FastWriter jfwWriter;
- std::string sObj = jfwWriter.write (jvObj);
+ std::string sObj = to_string (jvObj);
ScopedLockType sl (mLock);
NetworkOPs::SubMapType::const_iterator it = mListeners.begin ();
diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp
index 244943a61..209a90abe 100644
--- a/src/ripple/app/misc/NetworkOPs.cpp
+++ b/src/ripple/app/misc/NetworkOPs.cpp
@@ -1807,8 +1807,7 @@ void NetworkOPsImp::pubServer ()
jvObj [jss::load_factor] =
(mLastLoadFactor = getApp().getFeeTrack ().getLoadFactor ());
- Json::FastWriter w;
- std::string sObj = w.write (jvObj);
+ std::string sObj = to_string (jvObj);
for (auto i = mSubServer.begin (); i != mSubServer.end (); )
@@ -2701,8 +2700,7 @@ void NetworkOPsImp::pubValidatedTransaction (
*alTx.getTxn (), alTx.getResult (), true, alAccepted);
jvObj[jss::meta] = alTx.getMeta ()->getJson (0);
- Json::FastWriter w;
- std::string sObj = w.write (jvObj);
+ std::string sObj = to_string (jvObj);
{
ScopedLockType sl (mLock);
@@ -2814,8 +2812,7 @@ void NetworkOPsImp::pubAccountTransaction (
if (alTx.isApplied ())
jvObj[jss::meta] = alTx.getMeta ()->getJson (0);
- Json::FastWriter w;
- std::string sObj = w.write (jvObj);
+ std::string sObj = to_string (jvObj);
BOOST_FOREACH (InfoSub::ref isrListener, notify)
{
diff --git a/src/ripple/app/tx/TransactionEngine.cpp b/src/ripple/app/tx/TransactionEngine.cpp
index afab4ed31..1a043fc3e 100644
--- a/src/ripple/app/tx/TransactionEngine.cpp
+++ b/src/ripple/app/tx/TransactionEngine.cpp
@@ -92,7 +92,6 @@ TER TransactionEngine::applyTransaction (
{
WriteLog (lsFATAL, TransactionEngine) <<
"Transaction serdes mismatch";
- Json::StyledStreamWriter ssw;
WriteLog (lsINFO, TransactionEngine) << txn.getJson (0);
WriteLog (lsFATAL, TransactionEngine) << s2.getJson (0);
assert (false);
diff --git a/src/ripple/app/websocket/WSServerHandler.h b/src/ripple/app/websocket/WSServerHandler.h
index 55952890b..e3cc349a4 100644
--- a/src/ripple/app/websocket/WSServerHandler.h
+++ b/src/ripple/app/websocket/WSServerHandler.h
@@ -138,11 +138,9 @@ public:
void send (connection_ptr cpClient, Json::Value const& jvObj, bool broadcast)
{
- Json::FastWriter jfwWriter;
-
// WriteLog (lsDEBUG, WSServerHandlerLog) << "Ws:: Object '" << jfwWriter.write(jvObj) << "'";
- send (cpClient, jfwWriter.write (jvObj), broadcast);
+ send (cpClient, to_string (jvObj), broadcast);
}
void pingTimer (connection_ptr cpClient)
diff --git a/src/ripple/data/protocol/STObject.cpp b/src/ripple/data/protocol/STObject.cpp
index dcfc245ae..3ae7d1e6d 100644
--- a/src/ripple/data/protocol/STObject.cpp
+++ b/src/ripple/data/protocol/STObject.cpp
@@ -966,9 +966,8 @@ public:
if (parsedOK)
{
STParsedJSONObject parsed ("test", jsonObject);
- Json::FastWriter writer;
std::string const& serialized (
- writer.write (parsed.object->getJson(0)));
+ to_string (parsed.object->getJson(0)));
expect (serialized == json, serialized + " should equal: " + json);
}
else
diff --git a/src/ripple/json/impl/json_value.cpp b/src/ripple/json/impl/json_value.cpp
index e3783d2fe..02e96b635 100644
--- a/src/ripple/json/impl/json_value.cpp
+++ b/src/ripple/json/impl/json_value.cpp
@@ -18,6 +18,8 @@
//==============================================================================
#include
+#include
+#include
namespace Json {
diff --git a/src/ripple/json/impl/json_writer.cpp b/src/ripple/json/impl/json_writer.cpp
index 98cdf5929..79834e03f 100644
--- a/src/ripple/json/impl/json_writer.cpp
+++ b/src/ripple/json/impl/json_writer.cpp
@@ -17,6 +17,8 @@
*/
//==============================================================================
+#include
+
namespace Json
{
diff --git a/src/ripple/json/impl/to_string.cpp b/src/ripple/json/impl/to_string.cpp
new file mode 100644
index 000000000..1b173a226
--- /dev/null
+++ b/src/ripple/json/impl/to_string.cpp
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of rippled: https://github.com/ripple/rippled
+ Copyright (c) 2012, 2013 Ripple Labs Inc.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#include
+
+namespace Json
+{
+
+std::string to_string (Value const& value)
+{
+ return FastWriter ().write (value);
+}
+
+} // namespace Json
diff --git a/src/ripple/json/to_string.h b/src/ripple/json/to_string.h
new file mode 100644
index 000000000..47ccd4cc6
--- /dev/null
+++ b/src/ripple/json/to_string.h
@@ -0,0 +1,36 @@
+//------------------------------------------------------------------------------
+/*
+ This file is part of rippled: https://github.com/ripple/rippled
+ Copyright (c) 2012, 2013 Ripple Labs Inc.
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+//==============================================================================
+
+#ifndef JSON_TO_STRING_H_INCLUDED
+#define JSON_TO_STRING_H_INCLUDED
+
+namespace Json
+{
+
+class Value;
+
+/** Writes a Json::Value to an std::string. */
+std::string to_string (Value const&);
+
+/** Output using the StyledStreamWriter. @see Json::operator>>(). */
+std::ostream& operator<< (std::ostream&, const Value& root);
+
+} // Json
+
+#endif // JSON_TO_STRING_H_INCLUDED
diff --git a/src/ripple/net/impl/RPCUtil.cpp b/src/ripple/net/impl/RPCUtil.cpp
index 4282bc2c1..e10dc3336 100644
--- a/src/ripple/net/impl/RPCUtil.cpp
+++ b/src/ripple/net/impl/RPCUtil.cpp
@@ -300,8 +300,7 @@ std::string JSONRPCRequest (std::string const& strMethod, Json::Value const& par
request[jss::method] = strMethod;
request[jss::params] = params;
request[jss::id] = id;
- Json::FastWriter writer;
- return writer.write (request) + "\n";
+ return to_string (request) + "\n";
}
std::string JSONRPCReply (Json::Value const& result, Json::Value const& error, Json::Value const& id)
@@ -310,8 +309,7 @@ std::string JSONRPCReply (Json::Value const& result, Json::Value const& error, J
reply[jss::result] = result;
//reply["error"]=error;
//reply["id"]=id;
- Json::FastWriter writer;
- return writer.write (reply) + "\n";
+ return to_string (reply) + "\n";
}
void ErrorReply (std::ostream& stream, Json::Value const& objError, Json::Value const& id)
diff --git a/src/ripple/unity/json.cpp b/src/ripple/unity/json.cpp
index 9456e9b7d..66edf3c1d 100644
--- a/src/ripple/unity/json.cpp
+++ b/src/ripple/unity/json.cpp
@@ -43,6 +43,7 @@
#include
#include
#include
+#include
#include
diff --git a/src/ripple/unity/json.h b/src/ripple/unity/json.h
index 1034e01ba..e2f4e99f1 100644
--- a/src/ripple/unity/json.h
+++ b/src/ripple/unity/json.h
@@ -46,7 +46,7 @@
#include
#include
#include
-#include
+#include
#include