diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 7839e65..b063fa6 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -23,6 +23,7 @@
 #include <dbus_utility.hpp>
 #include <filesystem>
 #include <fstream>
+#include <json_msg_utility.hpp>
 #include <regex>
 #include <sdbusplus/message/types.hpp>
 
@@ -30,37 +31,10 @@
 {
 namespace openbmc_mapper
 {
-
 using GetSubTreeType = std::vector<
     std::pair<std::string,
               std::vector<std::pair<std::string, std::vector<std::string>>>>>;
 
-const std::string notFoundMsg = "404 Not Found";
-const std::string badReqMsg = "400 Bad Request";
-const std::string methodNotAllowedMsg = "405 Method Not Allowed";
-const std::string forbiddenMsg = "403 Forbidden";
-const std::string methodFailedMsg = "500 Method Call Failed";
-const std::string methodOutputFailedMsg = "500 Method Output Error";
-
-const std::string notFoundDesc =
-    "org.freedesktop.DBus.Error.FileNotFound: path or object not found";
-const std::string propNotFoundDesc = "The specified property cannot be found";
-const std::string noJsonDesc = "No JSON object could be decoded";
-const std::string methodNotFoundDesc = "The specified method cannot be found";
-const std::string methodNotAllowedDesc = "Method not allowed";
-const std::string forbiddenPropDesc =
-    "The specified property cannot be created";
-const std::string forbiddenResDesc = "The specified resource cannot be created";
-
-void setErrorResponse(crow::Response &res, boost::beast::http::status result,
-                      const std::string &desc, const std::string &msg)
-{
-    res.result(result);
-    res.jsonValue = {{"data", {{"description", desc}}},
-                     {"message", msg},
-                     {"status", "error"}};
-}
-
 void introspectObjects(const std::string &processName,
                        const std::string &objectPath,
                        std::shared_ptr<bmcweb::AsyncResp> transaction)
@@ -418,17 +392,19 @@
             {
                 if (!methodFailed)
                 {
-                    setErrorResponse(res, boost::beast::http::status::not_found,
-                                     methodNotFoundDesc, notFoundMsg);
+                    crow::setErrorResponse(
+                        res, boost::beast::http::status::not_found,
+                        crow::msg::methodNotFoundDesc, crow::msg::notFoundMsg);
                 }
             }
             else
             {
                 if (outputFailed)
                 {
-                    setErrorResponse(
+                    crow::setErrorResponse(
                         res, boost::beast::http::status::internal_server_error,
-                        "Method output failure", methodOutputFailedMsg);
+                        "Method output failure",
+                        crow::msg::methodOutputFailedMsg);
                 }
                 else
                 {
@@ -444,8 +420,8 @@
 
     void setErrorStatus(const std::string &desc)
     {
-        setErrorResponse(res, boost::beast::http::status::bad_request, desc,
-                         badReqMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::bad_request,
+                               desc, crow::msg::badReqMsg);
     }
     crow::Response &res;
     std::string path;
@@ -1442,7 +1418,7 @@
 
                                         if (e)
                                         {
-                                            setErrorResponse(
+                                            crow::setErrorResponse(
                                                 transaction->res,
                                                 boost::beast::http::status::
                                                     bad_request,
@@ -1450,12 +1426,12 @@
                                         }
                                         else
                                         {
-                                            setErrorResponse(
+                                            crow::setErrorResponse(
                                                 transaction->res,
                                                 boost::beast::http::status::
                                                     bad_request,
                                                 "Method call failed",
-                                                methodFailedMsg);
+                                                crow::msg::methodFailedMsg);
                                         }
                                         return;
                                     }
@@ -1489,24 +1465,24 @@
 
     if (requestDbusData.is_discarded())
     {
-        setErrorResponse(res, boost::beast::http::status::bad_request,
-                         noJsonDesc, badReqMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::bad_request,
+                               crow::msg::noJsonDesc, crow::msg::badReqMsg);
         res.end();
         return;
     }
     nlohmann::json::iterator data = requestDbusData.find("data");
     if (data == requestDbusData.end())
     {
-        setErrorResponse(res, boost::beast::http::status::bad_request,
-                         noJsonDesc, badReqMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::bad_request,
+                               crow::msg::noJsonDesc, crow::msg::badReqMsg);
         res.end();
         return;
     }
 
     if (!data->is_array())
     {
-        setErrorResponse(res, boost::beast::http::status::bad_request,
-                         noJsonDesc, badReqMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::bad_request,
+                               crow::msg::noJsonDesc, crow::msg::badReqMsg);
         res.end();
         return;
     }
@@ -1523,9 +1499,9 @@
             if (ec || interfaceNames.size() <= 0)
             {
                 BMCWEB_LOG_ERROR << "Can't find object";
-                setErrorResponse(transaction->res,
-                                 boost::beast::http::status::not_found,
-                                 notFoundDesc, notFoundMsg);
+                crow::setErrorResponse(
+                    transaction->res, boost::beast::http::status::not_found,
+                    crow::msg::notFoundDesc, crow::msg::notFoundMsg);
                 return;
             }
 
@@ -1557,9 +1533,10 @@
             if (ec || interfaceNames.size() <= 0)
             {
                 BMCWEB_LOG_ERROR << "Can't find object";
-                setErrorResponse(res,
-                                 boost::beast::http::status::method_not_allowed,
-                                 methodNotAllowedDesc, methodNotAllowedMsg);
+                crow::setErrorResponse(
+                    res, boost::beast::http::status::method_not_allowed,
+                    crow::msg::methodNotAllowedDesc,
+                    crow::msg::methodNotAllowedMsg);
                 res.end();
                 return;
             }
@@ -1589,8 +1566,9 @@
                std::vector<std::string> &objectPaths) {
             if (ec)
             {
-                setErrorResponse(res, boost::beast::http::status::not_found,
-                                 notFoundDesc, notFoundMsg);
+                crow::setErrorResponse(
+                    res, boost::beast::http::status::not_found,
+                    crow::msg::notFoundDesc, crow::msg::notFoundMsg);
             }
             else
             {
@@ -1628,9 +1606,10 @@
             {
                 BMCWEB_LOG_ERROR << "GetSubTree failed on "
                                  << transaction->objectPath;
-                setErrorResponse(transaction->asyncResp->res,
-                                 boost::beast::http::status::not_found,
-                                 notFoundDesc, notFoundMsg);
+                crow::setErrorResponse(transaction->asyncResp->res,
+                                       boost::beast::http::status::not_found,
+                                       crow::msg::notFoundDesc,
+                                       crow::msg::notFoundMsg);
                 return;
             }
 
@@ -1661,8 +1640,9 @@
                                    const GetObjectType &object_names) {
             if (ec || object_names.size() <= 0)
             {
-                setErrorResponse(res, boost::beast::http::status::not_found,
-                                 notFoundDesc, notFoundMsg);
+                crow::setErrorResponse(
+                    res, boost::beast::http::status::not_found,
+                    crow::msg::notFoundDesc, crow::msg::notFoundMsg);
                 res.end();
                 return;
             }
@@ -1678,8 +1658,9 @@
 
                 if (interfaceNames.size() <= 0)
                 {
-                    setErrorResponse(res, boost::beast::http::status::not_found,
-                                     notFoundDesc, notFoundMsg);
+                    crow::setErrorResponse(
+                        res, boost::beast::http::status::not_found,
+                        crow::msg::notFoundDesc, crow::msg::notFoundMsg);
                     res.end();
                     return;
                 }
@@ -1734,10 +1715,11 @@
                             {
                                 if (!propertyName->empty() && response->empty())
                                 {
-                                    setErrorResponse(
+                                    crow::setErrorResponse(
                                         res,
                                         boost::beast::http::status::not_found,
-                                        propNotFoundDesc, notFoundMsg);
+                                        crow::msg::propNotFoundDesc,
+                                        crow::msg::notFoundMsg);
                                 }
                                 else
                                 {
@@ -1766,8 +1748,9 @@
     {
         if (res.jsonValue.empty())
         {
-            setErrorResponse(res, boost::beast::http::status::forbidden,
-                             forbiddenMsg, forbiddenPropDesc);
+            crow::setErrorResponse(res, boost::beast::http::status::forbidden,
+                                   crow::msg::forbiddenMsg,
+                                   crow::msg::forbiddenPropDesc);
         }
 
         res.end();
@@ -1775,8 +1758,9 @@
 
     void setErrorStatus(const std::string &desc)
     {
-        setErrorResponse(res, boost::beast::http::status::internal_server_error,
-                         desc, badReqMsg);
+        crow::setErrorResponse(
+            res, boost::beast::http::status::internal_server_error, desc,
+            crow::msg::badReqMsg);
     }
 
     crow::Response &res;
@@ -1790,8 +1774,9 @@
 {
     if (destProperty.empty())
     {
-        setErrorResponse(res, boost::beast::http::status::forbidden,
-                         forbiddenResDesc, forbiddenMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::forbidden,
+                               crow::msg::forbiddenResDesc,
+                               crow::msg::forbiddenMsg);
         res.end();
         return;
     }
@@ -1801,8 +1786,8 @@
 
     if (requestDbusData.is_discarded())
     {
-        setErrorResponse(res, boost::beast::http::status::bad_request,
-                         noJsonDesc, badReqMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::bad_request,
+                               crow::msg::noJsonDesc, crow::msg::badReqMsg);
         res.end();
         return;
     }
@@ -1810,8 +1795,8 @@
     nlohmann::json::const_iterator propertyIt = requestDbusData.find("data");
     if (propertyIt == requestDbusData.end())
     {
-        setErrorResponse(res, boost::beast::http::status::bad_request,
-                         noJsonDesc, badReqMsg);
+        crow::setErrorResponse(res, boost::beast::http::status::bad_request,
+                               crow::msg::noJsonDesc, crow::msg::badReqMsg);
         res.end();
         return;
     }
@@ -1829,9 +1814,9 @@
                       const GetObjectType &object_names) {
             if (!ec && object_names.size() <= 0)
             {
-                setErrorResponse(transaction->res,
-                                 boost::beast::http::status::not_found,
-                                 propNotFoundDesc, notFoundMsg);
+                crow::setErrorResponse(
+                    transaction->res, boost::beast::http::status::not_found,
+                    crow::msg::propNotFoundDesc, crow::msg::notFoundMsg);
                 return;
             }
 
@@ -1947,7 +1932,7 @@
                                                     {
                                                         const sd_bus_error *e =
                                                             m.get_error();
-                                                        setErrorResponse(
+                                                        crow::setErrorResponse(
                                                             transaction->res,
                                                             boost::beast::http::
                                                                 status::
@@ -2057,8 +2042,9 @@
         return;
     }
 
-    setErrorResponse(res, boost::beast::http::status::method_not_allowed,
-                     methodNotAllowedDesc, methodNotAllowedMsg);
+    crow::setErrorResponse(res, boost::beast::http::status::method_not_allowed,
+                           crow::msg::methodNotAllowedDesc,
+                           crow::msg::methodNotAllowedMsg);
     res.end();
 }
 
