From 8a41a75c85eab54b67cc97526d49aea70d269bc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 3 Apr 2019 16:32:52 +0200
Subject: [PATCH] Apply modernize-raw-string-literal from clang-tidy

Use ReplaceShorterLiterals option to enforce replacement of all strings.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
---
 src/ComputingTasks.cc          | 474 ++++++++++++++++-----------------
 src/DataTree.cc                |   2 +-
 src/DynamicModel.cc            | 304 ++++++++++-----------
 src/DynareMain.cc              |   4 +-
 src/ExprNode.cc                | 160 +++++------
 src/ModFile.cc                 |  44 +--
 src/ModelTree.cc               |  80 +++---
 src/NumericalInitialization.cc |  54 ++--
 src/Shocks.cc                  |  98 +++----
 src/Statement.cc               |  32 +--
 src/StaticModel.cc             | 228 ++++++++--------
 src/SubModel.cc                |  22 +-
 src/SymbolList.cc              |   4 +-
 src/SymbolTable.cc             |  76 +++---
 src/macro/MacroDriver.cc       |   8 +-
 15 files changed, 795 insertions(+), 795 deletions(-)

diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index 30c04ba8..fee7b0d3 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -52,7 +52,7 @@ SteadyStatement::writeOutput(ostream &output, const string &basename, bool minim
 void
 SteadyStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"steady\"";
+  output << R"({"statementName": "steady")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -82,7 +82,7 @@ CheckStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidatio
 void
 CheckStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"check\"";
+  output << R"({"statementName": "check")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -112,7 +112,7 @@ ModelInfoStatement::writeOutput(ostream &output, const string &basename, bool mi
 void
 ModelInfoStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"model_info\"";
+  output << R"({"statementName": "model_info")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -143,7 +143,7 @@ SimulStatement::writeOutput(ostream &output, const string &basename, bool minima
 void
 SimulStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"simul\"";
+  output << R"({"statementName": "simul")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -167,7 +167,7 @@ PerfectForesightSetupStatement::writeOutput(ostream &output, const string &basen
 void
 PerfectForesightSetupStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"perfect_foresight_setup\"";
+  output << R"({"statementName": "perfect_foresight_setup")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -200,7 +200,7 @@ PerfectForesightSolverStatement::writeOutput(ostream &output, const string &base
 void
 PerfectForesightSolverStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"perfect_foresight_solver\"";
+  output << R"({"statementName": "perfect_foresight_solver")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -248,7 +248,7 @@ PriorPosteriorFunctionStatement::writeJsonOutput(ostream &output) const
   string type = "posterior";
   if (prior_func)
     type = "prior";
-  output << "{\"statementName\": \"prior_posterior_function\", \"type\": \"" << type << "\"";
+  output << R"({"statementName": "prior_posterior_function", "type": ")" << type << R"(")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -406,10 +406,10 @@ PacModelStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 PacModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"pac_model\","
-         << "\"model_name\": \"" << name << "\","
-         << "\"auxiliary_model_name\": \"" << aux_model_name << "\","
-         << "\"discount_index\": " << symbol_table.getTypeSpecificID(discount) + 1;
+  output << R"({"statementName": "pac_model",)"
+         << R"("model_name": ")" << name << R"(",)"
+         << R"("auxiliary_model_name": ")" << aux_model_name << R"(",)"
+         << R"("discount_index": )" << symbol_table.getTypeSpecificID(discount) + 1;
 
   if (growth_symb_id >= 0)
     {
@@ -430,12 +430,12 @@ PacModelStatement::writeJsonOutput(ostream &output) const
           }
         }
       output << ","
-             << "\"growth_index\": " << symbol_table.getTypeSpecificID(growth_symb_id) + 1 << ","
-             << "\"growth_lag\": " << growth_lag << ","
-             << "\"growth_type\": \"" << growth_type << "\"," << endl
-             << "\"growth_str\": \"";
+             << R"("growth_index": )" << symbol_table.getTypeSpecificID(growth_symb_id) + 1 << ","
+             << R"("growth_lag": )" << growth_lag << ","
+             << R"("growth_type": ")" << growth_type << R"(",)" << endl
+             << R"("growth_str": ")";
       original_growth->writeJsonOutput(output, {}, {}, true);
-      output << "\"" << endl;
+      output << R"(")" << endl;
     }
   output << "}";
 }
@@ -697,7 +697,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename, bool m
 void
 StochSimulStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"stoch_simul\"";
+  output << R"({"statementName": "stoch_simul")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -729,7 +729,7 @@ ForecastStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 ForecastStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"forecast\"";
+  output << R"({"statementName": "forecast")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -781,7 +781,7 @@ DetCondForecast::writeOutput(ostream &output, const string &basename, bool minim
       output << " options_.periods = 0;" << endl;
       output << " var_list_ = char();" << endl;
       output << " info = stoch_simul(var_list_);" << endl;
-      output << " fprintf('%s\\n','done');" << endl;
+      output << R"( fprintf('%s\n','done');)" << endl;
       output << " options_.periods = tmp_periods;" << endl;
       output << "end;" << endl;
     }
@@ -853,7 +853,7 @@ RamseyModelStatement::writeOutput(ostream &output, const string &basename, bool
 void
 RamseyModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ramsey_model\"";
+  output << R"({"statementName": "ramsey_model")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -912,13 +912,13 @@ RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename,
 void
 RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ramsey_constraints\""
-         << ", \"ramsey_model_constraints\": [" << endl;
+  output << R"({"statementName": "ramsey_constraints")"
+         << R"(, "ramsey_model_constraints": [)" << endl;
   for (auto it = constraints.begin(); it != constraints.end(); ++it)
     {
       if (it != constraints.begin())
         output << ", ";
-      output << "{\"constraint\": \"" << symbol_table.getName(it->endo) << " ";
+      output << R"({"constraint": ")" << symbol_table.getName(it->endo) << " ";
       switch (it->code)
         {
         case BinaryOpcode::less:
@@ -939,7 +939,7 @@ RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
         }
       output << " ";
       it->expression->writeJsonOutput(output, {}, {});
-      output << "\"}" << endl;
+      output << R"("})" << endl;
     }
   output << "]" << endl;
   output << "}";
@@ -1034,19 +1034,19 @@ RamseyPolicyStatement::writeOutput(ostream &output, const string &basename, bool
 void
 RamseyPolicyStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ramsey_policy\"";
+  output << R"({"statementName": "ramsey_policy")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
       options_list.writeJsonOutput(output);
     }
-  output << ", \"ramsey_policy_list\": [";
+  output << R"(, "ramsey_policy_list": [)";
   for (auto it = ramsey_policy_list.begin();
        it != ramsey_policy_list.end(); ++it)
     {
       if (it != ramsey_policy_list.begin())
         output << ",";
-      output << "\"" << *it << "\"";
+      output << R"(")" << *it << R"(")";
     }
   output << "]"
          << "}";
@@ -1115,7 +1115,7 @@ DiscretionaryPolicyStatement::writeOutput(ostream &output, const string &basenam
 void
 DiscretionaryPolicyStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"discretionary_policy\"";
+  output << R"({"statementName": "discretionary_policy")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -1237,7 +1237,7 @@ EstimationStatement::writeOutput(ostream &output, const string &basename, bool m
 void
 EstimationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"estimation\"";
+  output << R"({"statementName": "estimation")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -1291,7 +1291,7 @@ DynareSensitivityStatement::writeOutput(ostream &output, const string &basename,
 void
 DynareSensitivityStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"dynare_sensitivity\"";
+  output << R"({"statementName": "dynare_sensitivity")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -1315,7 +1315,7 @@ RplotStatement::writeOutput(ostream &output, const string &basename, bool minima
 void
 RplotStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"rplot\"";
+  output << R"({"statementName": "rplot")";
   if (!symbol_list.empty())
     {
       output << ", ";
@@ -1334,9 +1334,9 @@ UnitRootVarsStatement::writeOutput(ostream &output, const string &basename, bool
 void
 UnitRootVarsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"unit_root_vars\", "
-         << "\"diffuse_filter\": 1, "
-         << "\"steady_state.nocheck\": 1}";
+  output << R"({"statementName": "unit_root_vars", )"
+         << R"("diffuse_filter": 1, )"
+         << R"("steady_state.nocheck": 1})";
 }
 
 PeriodsStatement::PeriodsStatement(int periods_arg) : periods{periods_arg}
@@ -1352,8 +1352,8 @@ PeriodsStatement::writeOutput(ostream &output, const string &basename, bool mini
 void
 PeriodsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"periods\", "
-         << "\"periods\": " << periods << "}";
+  output << R"({"statementName": "periods", )"
+         << R"("periods": )" << periods << "}";
 }
 
 DsampleStatement::DsampleStatement(int val1_arg) : val1{val1_arg}, val2{-1}
@@ -1376,9 +1376,9 @@ DsampleStatement::writeOutput(ostream &output, const string &basename, bool mini
 void
 DsampleStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"dsample\", "
-         << "\"value1\": " << val1 << ", "
-         << "\"value2\": " << val2 << "}";
+  output << R"({"statementName": "dsample", )"
+         << R"("value1": )" << val1 << ", "
+         << R"("value2": )" << val2 << "}";
 }
 
 EstimatedParamsStatement::EstimatedParamsStatement(vector<EstimationParams> estim_params_list_arg,
@@ -1508,8 +1508,8 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, b
 void
 EstimatedParamsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"estimated_params\", "
-         << "\"params\": [";
+  output << R"({"statementName": "estimated_params", )"
+         << R"("params": [)";
   for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
     {
       if (it != estim_params_list.begin())
@@ -1518,36 +1518,36 @@ EstimatedParamsStatement::writeJsonOutput(ostream &output) const
       switch (it->type)
         {
         case 1:
-          output << "\"var\": \"" << it->name << "\"";
+          output << R"("var": ")" << it->name << R"(")";
           break;
         case 2:
-          output << "\"param\": \"" << it->name << "\"";
+          output << R"("param": ")" << it->name << R"(")";
           break;
         case 3:
-          output << "\"var1\": \"" << it->name << "\","
-                 << "\"var2\": \"" << it->name2 << "\"";
+          output << R"("var1": ")" << it->name << R"(",)"
+                 << R"("var2": ")" << it->name2 << R"(")";
           break;
         }
 
-      output << ", \"init_val\": \"";
+      output << R"(, "init_val": ")";
       it->init_val->writeJsonOutput(output, {}, {});
-      output << "\", \"lower_bound\": \"";
+      output << R"(", "lower_bound": ")";
       it->low_bound->writeJsonOutput(output, {}, {});
-      output << "\", \"upper_bound\": \"";
+      output << R"(", "upper_bound": ")";
       it->up_bound->writeJsonOutput(output, {}, {});
-      output << "\", \"prior_distribution\": "
+      output << R"(", "prior_distribution": )"
              << static_cast<int>(it->prior)
-             << ", \"mean\": \"";
+             << R"(, "mean": ")";
       it->mean->writeJsonOutput(output, {}, {});
-      output << "\", \"std\": \"";
+      output << R"(", "std": ")";
       it->std->writeJsonOutput(output, {}, {});
-      output << "\", \"p3\": \"";
+      output << R"(", "p3": ")";
       it->p3->writeJsonOutput(output, {}, {});
-      output << "\", \"p4\": \"";
+      output << R"(", "p4": ")";
       it->p4->writeJsonOutput(output, {}, {});
-      output << "\", \"jscale\": \"";
+      output << R"(", "jscale": ")";
       it->jscale->writeJsonOutput(output, {}, {});
-      output << "\"}" << endl;
+      output << R"("})" << endl;
     }
   output << "]"
          << "}";
@@ -1660,12 +1660,12 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam
 void
 EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"estimated_params_init\"";
+  output << R"({"statementName": "estimated_params_init")";
 
   if (use_calibration)
-    output << ", \"use_calibration_initialization\": 1";
+    output << R"(, "use_calibration_initialization": 1)";
 
-  output << ", \"params\": [";
+  output << R"(, "params": [)";
   for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
     {
       if (it != estim_params_list.begin())
@@ -1674,19 +1674,19 @@ EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
       switch (it->type)
         {
         case 1:
-          output << "\"var\": \"" << it->name << "\"";
+          output << R"("var": ")" << it->name << R"(")";
           break;
         case 2:
-          output << "\"param\": \"" << it->name << "\"";
+          output << R"("param": ")" << it->name << R"(")";
           break;
         case 3:
-          output << "\"var1\": \"" << it->name << "\","
-                 << "\"var2\": \"" << it->name2 << "\"";
+          output << R"("var1": ")" << it->name << R"(",)"
+                 << R"("var2": ")" << it->name2 << R"(")";
           break;
         }
-      output << ", \"init_val\": \"";
+      output << R"(, "init_val": ")";
       it->init_val->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
          << "}";
@@ -1781,8 +1781,8 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
 void
 EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"estimated_params_bounds\", "
-         << "\"params\": [";
+  output << R"({"statementName": "estimated_params_bounds", )"
+         << R"("params": [)";
 
   for (auto it = estim_params_list.begin(); it != estim_params_list.end(); it++)
     {
@@ -1792,18 +1792,18 @@ EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
       switch (it->type)
         {
         case 1:
-          output << "\"var\": \"" << it->name << "\"";
+          output << R"("var": ")" << it->name << R"(")";
         case 2:
-          output << "\"param\": \"" << it->name << "\"";
+          output << R"("param": ")" << it->name << R"(")";
           break;
         case 3:
-          output << "\"var1\": \"" << it->name << "\","
-                 << "\"var2\": \"" << it->name2 << "\"";
+          output << R"("var1": ")" << it->name << R"(",)"
+                 << R"("var2": ")" << it->name2 << R"(")";
           break;
         }
-      output << ", \"lower_bound\": ";
+      output << R"(, "lower_bound": )";
       it->low_bound->writeJsonOutput(output, {}, {});
-      output << ", \"upper_bound\": ";
+      output << R"(, "upper_bound": )";
       it->up_bound->writeJsonOutput(output, {}, {});
       output << "}";
     }
@@ -1840,8 +1840,8 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename,
 void
 ObservationTrendsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"observation_trends\", "
-         << "\"trends\" : {";
+  output << R"({"statementName": "observation_trends", )"
+         << R"("trends" : {)";
   bool printed = false;
   for (const auto & trend_element : trend_elements)
     {
@@ -1849,9 +1849,9 @@ ObservationTrendsStatement::writeJsonOutput(ostream &output) const
         {
           if (printed)
             output << ", ";
-          output << "\"" << trend_element.first << "\": \"";
+          output << R"(")" << trend_element.first << R"(": ")";
           trend_element.second->writeJsonOutput(output, {}, {});
-          output << "\"" << endl;
+          output << R"(")" << endl;
           printed = true;
         }
       else
@@ -1890,7 +1890,7 @@ OsrParamsStatement::writeOutput(ostream &output, const string &basename, bool mi
 void
 OsrParamsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"osr_params\"";
+  output << R"({"statementName": "osr_params")";
   if (!symbol_list.empty())
     {
       output << ", ";
@@ -1940,19 +1940,19 @@ OsrParamsBoundsStatement::writeOutput(ostream &output, const string &basename, b
 void
 OsrParamsBoundsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"osr_params_bounds\""
-         << ", \"bounds\": [";
+  output << R"({"statementName": "osr_params_bounds")"
+         << R"(, "bounds": [)";
   for (auto it = osr_params_list.begin();
        it != osr_params_list.end(); it++)
     {
       if (it != osr_params_list.begin())
         output << ", ";
-      output << "{\"parameter\": \"" << it->name << "\","
-             << "\"bounds\": [\"";
+      output << R"({"parameter": ")" << it->name << R"(",)"
+             << R"("bounds": [")";
       it->low_bound->writeJsonOutput(output, {}, {});
-      output << "\", \"";
+      output << R"(", ")";
       it->up_bound->writeJsonOutput(output, {}, {});
-      output << "\"]"
+      output << R"("])"
              << "}";
     }
   output << "]"
@@ -1999,7 +1999,7 @@ OsrStatement::writeOutput(ostream &output, const string &basename, bool minimal_
 void
 OsrStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"osr\"";
+  output << R"({"statementName": "osr")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2065,17 +2065,17 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename, bool
 void
 OptimWeightsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"optim_weights\", "
-         << "\"weights\": [";
+  output << R"({"statementName": "optim_weights", )"
+         << R"("weights": [)";
   for (auto it = var_weights.begin();
        it != var_weights.end(); it++)
     {
       if (it != var_weights.begin())
         output << ", ";
-      output << "{\"name\": \"" << it->first << "\""
-             << ", \"value\": \"";
+      output << R"({"name": ")" << it->first << R"(")"
+             << R"(, "value": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
 
   for (auto it = covar_weights.begin();
@@ -2083,11 +2083,11 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
     {
       if (it != covar_weights.begin() || !var_weights.empty())
         output << ", ";
-      output << "{\"name1\": \"" << it->first.first << "\""
-             << ", \"name2\": \"" << it->first.second << "\""
-             << ", \"value\": \"";
+      output << R"({"name1": ")" << it->first.first << R"(")"
+             << R"(, "name2": ")" << it->first.second << R"(")"
+             << R"(, "value": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
          << "}";
@@ -2111,8 +2111,8 @@ DynaSaveStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 DynaSaveStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"dynasave\", "
-         << "\"filename\": \"" << filename << "\"";
+  output << R"({"statementName": "dynasave", )"
+         << R"("filename": ")" << filename << R"(")";
   if (!symbol_list.empty())
     {
       output << ", ";
@@ -2139,8 +2139,8 @@ DynaTypeStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 DynaTypeStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"dynatype\", "
-         << "\"filename\": \"" << filename << "\"";
+  output << R"({"statementName": "dynatype", )"
+         << R"("filename": ")" << filename << R"(")";
   if (!symbol_list.empty())
     {
       output << ", ";
@@ -2175,17 +2175,17 @@ ModelComparisonStatement::writeOutput(ostream &output, const string &basename, b
 void
 ModelComparisonStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"model_comparison\"";
+  output << R"({"statementName": "model_comparison")";
   if (!filename_list.empty())
-    output << ", \"filename_list\": {";
+    output << R"(, "filename_list": {)";
 
   for (auto it = filename_list.begin();
        it != filename_list.end(); it++)
     {
       if (it != filename_list.begin())
         output << ", ";
-      output << "\"name\": \"" << it->first << "\""
-             << "\"prior\": \"" << it->second << "\"";
+      output << R"("name": ")" << it->first << R"(")"
+             << R"("prior": ")" << it->second << R"(")";
     }
 
   if (!filename_list.empty())
@@ -2241,7 +2241,7 @@ PlannerObjectiveStatement::writeOutput(ostream &output, const string &basename,
 void
 PlannerObjectiveStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"planner_objective\""
+  output << R"({"statementName": "planner_objective")"
          << ", ";
   if (computing_pass_called)
     model_tree.writeJsonComputingPassOutput(output, false);
@@ -2273,7 +2273,7 @@ BVARDensityStatement::writeOutput(ostream &output, const string &basename, bool
 void
 BVARDensityStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"bvar_density\"";
+  output << R"({"statementName": "bvar_density")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2304,7 +2304,7 @@ BVARForecastStatement::writeOutput(ostream &output, const string &basename, bool
 void
 BVARForecastStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"bvar_forecast\"";
+  output << R"({"statementName": "bvar_forecast")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2334,7 +2334,7 @@ SBVARStatement::writeOutput(ostream &output, const string &basename, bool minima
 void
 SBVARStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"sbvar\"";
+  output << R"({"statementName": "sbvar")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2375,7 +2375,7 @@ MSSBVAREstimationStatement::writeOutput(ostream &output, const string &basename,
 void
 MSSBVAREstimationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_estimation\"";
+  output << R"({"statementName": "ms_sbvar_estimation")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2415,7 +2415,7 @@ MSSBVARSimulationStatement::writeOutput(ostream &output, const string &basename,
 void
 MSSBVARSimulationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_simulation\"";
+  output << R"({"statementName": "ms_sbvar_simulation")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2446,7 +2446,7 @@ MSSBVARComputeMDDStatement::writeOutput(ostream &output, const string &basename,
 void
 MSSBVARComputeMDDStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_compute_mdd\"";
+  output << R"({"statementName": "ms_sbvar_compute_mdd")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2485,7 +2485,7 @@ MSSBVARComputeProbabilitiesStatement::writeOutput(ostream &output, const string
 void
 MSSBVARComputeProbabilitiesStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_compute_probabilities\"";
+  output << R"({"statementName": "ms_sbvar_compute_probabilities")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2544,7 +2544,7 @@ MSSBVARIrfStatement::writeOutput(ostream &output, const string &basename, bool m
 void
 MSSBVARIrfStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_irf\"";
+  output << R"({"statementName": "ms_sbvar_irf")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2587,7 +2587,7 @@ MSSBVARForecastStatement::writeOutput(ostream &output, const string &basename, b
 void
 MSSBVARForecastStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_forecast\"";
+  output << R"({"statementName": "ms_sbvar_forecast")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2643,7 +2643,7 @@ MSSBVARVarianceDecompositionStatement::writeOutput(ostream &output, const string
 void
 MSSBVARVarianceDecompositionStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"ms_sbvar_variance_decomposition\"";
+  output << R"({"statementName": "ms_sbvar_variance_decomposition")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2694,7 +2694,7 @@ IdentificationStatement::writeOutput(ostream &output, const string &basename, bo
 void
 IdentificationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"identification\"";
+  output << R"({"statementName": "identification")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2718,7 +2718,7 @@ WriteLatexDynamicModelStatement::writeOutput(ostream &output, const string &base
 void
 WriteLatexDynamicModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"write_latex_dynamic_model\"}";
+  output << R"({"statementName": "write_latex_dynamic_model"})";
 }
 
 WriteLatexStaticModelStatement::WriteLatexStaticModelStatement(const StaticModel &static_model_arg, bool write_equation_tags_arg) :
@@ -2736,7 +2736,7 @@ WriteLatexStaticModelStatement::writeOutput(ostream &output, const string &basen
 void
 WriteLatexStaticModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"write_latex_static_model\"}";
+  output << R"({"statementName": "write_latex_static_model"})";
 }
 
 WriteLatexOriginalModelStatement::WriteLatexOriginalModelStatement(const DynamicModel &original_model_arg, bool write_equation_tags_arg) :
@@ -2754,7 +2754,7 @@ WriteLatexOriginalModelStatement::writeOutput(ostream &output, const string &bas
 void
 WriteLatexOriginalModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"write_latex_original_model\"}";
+  output << R"({"statementName": "write_latex_original_model"})";
 }
 
 WriteLatexSteadyStateModelStatement::WriteLatexSteadyStateModelStatement(const SteadyStateModel &steady_state_model_arg) :
@@ -2777,7 +2777,7 @@ WriteLatexSteadyStateModelStatement::writeOutput(ostream &output, const string &
 void
 WriteLatexSteadyStateModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"write_latex_steady_state_model\"}";
+  output << R"({"statementName": "write_latex_steady_state_model"})";
 }
 
 ShockDecompositionStatement::ShockDecompositionStatement(SymbolList symbol_list_arg,
@@ -2798,7 +2798,7 @@ ShockDecompositionStatement::writeOutput(ostream &output, const string &basename
 void
 ShockDecompositionStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"shock_decomposition\"";
+  output << R"({"statementName": "shock_decomposition")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2884,7 +2884,7 @@ ConditionalForecastStatement::writeOutput(ostream &output, const string &basenam
 void
 ConditionalForecastStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"conditional_forecast\"";
+  output << R"({"statementName": "conditional_forecast")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -2912,8 +2912,8 @@ PlotConditionalForecastStatement::writeOutput(ostream &output, const string &bas
 void
 PlotConditionalForecastStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"plot_conditional_forecast\", "
-         << "\"periods\": " << periods;
+  output << R"({"statementName": "plot_conditional_forecast", )"
+         << R"("periods": )" << periods;
   if (!symbol_list.empty())
     {
       output << ", ";
@@ -3035,33 +3035,33 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
 void
 SvarIdentificationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"svar_identification\"";
+  output << R"({"statementName": "svar_identification")";
 
   if (upper_cholesky_present)
-    output << ", \"upper_cholesky\": 1";
+    output << R"(, "upper_cholesky": 1)";
 
   if (lower_cholesky_present)
-    output << ", \"lower_cholesky\": 1";
+    output << R"(, "lower_cholesky": 1)";
 
   if (constants_exclusion_present)
-    output << ", \"constants_exclusion\": 1";
+    output << R"(, "constants_exclusion": 1)";
 
   if (!upper_cholesky_present && !lower_cholesky_present)
     {
-      output << ", \"nlags\": " << getMaxLag()
-             << ", \"restrictions\": [";
+      output << R"(, "nlags": )" << getMaxLag()
+             << R"(, "restrictions": [)";
 
       for (auto it = restrictions.begin(); it != restrictions.end(); it++)
         {
           if (it != restrictions.begin())
             output << ", ";
           output << "{"
-                 << "\"equation_number\": " << it->equation << ", "
-                 << "\"restriction_number\": " << it->restriction_nbr << ", "
-                 << "\"variable\": \"" << symbol_table.getName(it->variable) << "\", "
-                 << "\"expression\": \"";
+                 << R"("equation_number": )" << it->equation << ", "
+                 << R"("restriction_number": )" << it->restriction_nbr << ", "
+                 << R"("variable": ")" << symbol_table.getName(it->variable) << R"(", )"
+                 << R"("expression": ")";
           it->value->writeOutput(output);
-          output << "\"}";
+          output << R"("})";
         }
       output << "]";
     }
@@ -3292,7 +3292,7 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
   vector<string> parameters = itsl->second.get_symbols();
   output << "parameters.clear();" << endl;
   for (auto & parameter : parameters)
-    output << "parameters.push_back(param_names[\"" << parameter << "\"]);" << endl;
+    output << R"(parameters.push_back(param_names[")" << parameter << R"("]);)" << endl;
 
   output << "restriction_map.clear();" << endl;
   for (auto & itrm : restriction_map)
@@ -3306,7 +3306,7 @@ MarkovSwitchingStatement::writeCOutput(ostream &output, const string &basename)
 void
 MarkovSwitchingStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"markov_switching\"";
+  output << R"({"statementName": "markov_switching")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -3320,9 +3320,9 @@ MarkovSwitchingStatement::writeJsonOutput(ostream &output) const
     {
       if (it != restriction_map.begin())
         output << ", ";
-      output << "{\"current_period_regime\": " << it->first.first
-             << ", \"next_period_regime\": " << it->first.second
-             << ", \"transition_probability\": "<< it->second
+      output << R"({"current_period_regime": )" << it->first.first
+             << R"(, "next_period_regime": )" << it->first.second
+             << R"(, "transition_probability": )"<< it->second
              << "}";
     }
   if (!restriction_map.empty())
@@ -3396,7 +3396,7 @@ SvarStatement::writeOutput(ostream &output, const string &basename, bool minimal
 void
 SvarStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"svar\"";
+  output << R"({"statementName": "svar")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -3414,7 +3414,7 @@ SvarGlobalIdentificationCheckStatement::writeOutput(ostream &output, const strin
 void
 SvarGlobalIdentificationCheckStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"svar_global_identification\"}";
+  output << R"({"statementName": "svar_global_identification"})";
 }
 
 SetTimeStatement::SetTimeStatement(OptionsList options_list_arg) :
@@ -3431,7 +3431,7 @@ SetTimeStatement::writeOutput(ostream &output, const string &basename, bool mini
 void
 SetTimeStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"set_time\"";
+  output << R"({"statementName": "set_time")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -3482,7 +3482,7 @@ EstimationDataStatement::writeOutput(ostream &output, const string &basename, bo
 void
 EstimationDataStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"estimation_data\"";
+  output << R"({"statementName": "estimation_data")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -3567,21 +3567,21 @@ SubsamplesStatement::writeOutput(ostream &output, const string &basename, bool m
 void
 SubsamplesStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"subsamples\""
-         << ", \"name1\": \"" << name1 << "\"";
+  output << R"({"statementName": "subsamples")"
+         << R"(, "name1": ")" << name1 << R"(")";
   if (!name2.empty())
-    output << ", \"name2\": \"" << name2 << "\"";
+    output << R"(, "name2": ")" << name2 << R"(")";
 
-  output << ", \"declarations\": {";
+  output << R"(, "declarations": {)";
   for (auto it = subsample_declaration_map.begin();
        it != subsample_declaration_map.end(); it++)
     {
       if (it != subsample_declaration_map.begin())
         output << ",";
       output << "{"
-             << "\"range_index\": \"" << it->first << "\""
-             << ", \"date1\": \"" << it->second.first << "\""
-             << ", \"date2\": \"" << it->second.second << "\""
+             << R"("range_index": ")" << it->first << R"(")"
+             << R"(, "date1": ")" << it->second.first << R"(")"
+             << R"(, "date2": ")" << it->second.second << R"(")"
              << "}";
     }
   output << "}"
@@ -3653,13 +3653,13 @@ SubsamplesEqualStatement::writeOutput(ostream &output, const string &basename, b
 void
 SubsamplesEqualStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"subsamples_equal\""
-         << ", \"to_name1\": \"" << to_name1 << "\"";
+  output << R"({"statementName": "subsamples_equal")"
+         << R"(, "to_name1": ")" << to_name1 << R"(")";
   if (!to_name2.empty())
-    output << ", \"to_name2\": \"" << to_name2 << "\"";
-  output << ", \"from_name1\": \"" << from_name1 << "\"";
+    output << R"(, "to_name2": ")" << to_name2 << R"(")";
+  output << R"(, "from_name1": ")" << from_name1 << R"(")";
   if (!from_name2.empty())
-    output << ", \"from_name2\": \"" << from_name2 << "\"";
+    output << R"(, "from_name2": ")" << from_name2 << R"(")";
   output << "}";
 }
 
@@ -3772,13 +3772,13 @@ JointPriorStatement::writeOutputHelper(ostream &output, const string &field, con
 void
 JointPriorStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"joint_prior\""
-         << ", \"key\": [";
+  output << R"({"statementName": "joint_prior")"
+         << R"(, "key": [)";
   for (auto it = joint_parameters.begin(); it != joint_parameters.end(); it++)
     {
       if (it != joint_parameters.begin())
         output << ", ";
-      output << "\"" << *it << "\"";
+      output << R"(")" << *it << R"(")";
     }
   output << "]";
 
@@ -3788,32 +3788,32 @@ JointPriorStatement::writeJsonOutput(ostream &output) const
       options_list.writeJsonOutput(output);
     }
 
-  output << ", \"shape\": ";
+  output << R"(, "shape": )";
   switch (prior_shape)
     {
     case PriorDistributions::beta:
-      output << "\"beta\"";
+      output << R"("beta")";
       break;
     case PriorDistributions::gamma:
-      output << "\"gamma\"";
+      output << R"("gamma")";
       break;
     case PriorDistributions::normal:
-      output << "\"normal\"";
+      output << R"("normal")";
       break;
     case PriorDistributions::invGamma:
-      output << "\"inv_gamma\"";
+      output << R"("inv_gamma")";
       break;
     case PriorDistributions::uniform:
-      output << "\"uniform\"";
+      output << R"("uniform")";
       break;
     case PriorDistributions::invGamma2:
-      output << "\"inv_gamma2\"";
+      output << R"("inv_gamma2")";
       break;
     case PriorDistributions::dirichlet:
-      output << "\"dirichlet\"";
+      output << R"("dirichlet")";
       break;
     case PriorDistributions::weibull:
-      output << "\"weibull\"";
+      output << R"("weibull")";
       break;
     case PriorDistributions::noShape:
       cerr << "Impossible case." << endl;
@@ -3941,15 +3941,15 @@ BasicPriorStatement::writePriorOutput(ostream &output, string &lhs_field, const
 void
 BasicPriorStatement::writeJsonPriorOutput(ostream &output) const
 {
-  output << ", \"name\": \"" << name << "\""
-         << ", \"subsample\": \"" << subsample_name << "\""
+  output << R"(, "name": ")" << name << R"(")"
+         << R"(, "subsample": ")" << subsample_name << R"(")"
          << ", ";
   writeJsonShape(output);
   if (variance != nullptr)
     {
-      output << ", \"variance\": \"";
+      output << R"(, "variance": ")";
       variance->writeJsonOutput(output, {}, {});
-      output << "\"";
+      output << R"(")";
     }
   if (options_list.getNumberOfOptions())
     {
@@ -4002,28 +4002,28 @@ BasicPriorStatement::writeCShape(ostream &output) const
   switch (prior_shape)
     {
     case PriorDistributions::beta:
-      output << "\"beta\";" << endl;
+      output << R"("beta";)" << endl;
       break;
     case PriorDistributions::gamma:
-      output << "\"gamma\";" << endl;
+      output << R"("gamma";)" << endl;
       break;
     case PriorDistributions::normal:
-      output << "\"normal\";" << endl;
+      output << R"("normal";)" << endl;
       break;
     case PriorDistributions::invGamma:
-      output << "\"inv_gamma\";" << endl;
+      output << R"("inv_gamma";)" << endl;
       break;
     case PriorDistributions::uniform:
-      output << "\"uniform\";" << endl;
+      output << R"("uniform";)" << endl;
       break;
     case PriorDistributions::invGamma2:
-      output << "\"inv_gamma2\";" << endl;
+      output << R"("inv_gamma2";)" << endl;
       break;
     case PriorDistributions::dirichlet:
-      output << "\"dirichlet\";" << endl;
+      output << R"("dirichlet";)" << endl;
       break;
     case PriorDistributions::weibull:
-      output << "\"weibull\";" << endl;
+      output << R"("weibull";)" << endl;
       break;
     case PriorDistributions::noShape:
       assert(prior_shape != PriorDistributions::noShape);
@@ -4033,32 +4033,32 @@ BasicPriorStatement::writeCShape(ostream &output) const
 void
 BasicPriorStatement::writeJsonShape(ostream &output) const
 {
-  output << "\"shape\": ";
+  output << R"("shape": )";
   switch (prior_shape)
     {
     case PriorDistributions::beta:
-      output << "\"beta\"";
+      output << R"("beta")";
       break;
     case PriorDistributions::gamma:
-      output << "\"gamma\"";
+      output << R"("gamma")";
       break;
     case PriorDistributions::normal:
-      output << "\"normal\"";
+      output << R"("normal")";
       break;
     case PriorDistributions::invGamma:
-      output << "\"inv_gamma\"";
+      output << R"("inv_gamma")";
       break;
     case PriorDistributions::uniform:
-      output << "\"uniform\"";
+      output << R"("uniform")";
       break;
     case PriorDistributions::invGamma2:
-      output << "\"inv_gamma2\"";
+      output << R"("inv_gamma2")";
       break;
     case PriorDistributions::dirichlet:
-      output << "\"dirichlet\"";
+      output << R"("dirichlet")";
       break;
     case PriorDistributions::weibull:
-      output << "\"weibull\"";
+      output << R"("weibull")";
       break;
     case PriorDistributions::noShape:
       assert(prior_shape != PriorDistributions::noShape);
@@ -4087,7 +4087,7 @@ PriorStatement::writeOutput(ostream &output, const string &basename, bool minima
 void
 PriorStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"prior\"";
+  output << R"({"statementName": "prior")";
   writeJsonPriorOutput(output);
   output << "}";
 }
@@ -4096,7 +4096,7 @@ void
 PriorStatement::writeCOutput(ostream &output, const string &basename)
 {
   output << endl
-         << "index = param_names[\""<< name << "\"];" << endl;
+         << R"(index = param_names[")"<< name << R"("];)" << endl;
   writeCShape(output);
   writeCOutputHelper(output, "mean");
   writeCOutputHelper(output, "mode");
@@ -4135,7 +4135,7 @@ StdPriorStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 StdPriorStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"std_prior\"";
+  output << R"({"statementName": "std_prior")";
   writeJsonPriorOutput(output);
   output << "}";
 }
@@ -4149,7 +4149,7 @@ StdPriorStatement::writeCOutput(ostream &output, const string &basename)
     output << "exo_names";
   else
     output << "endo_names";
-  output << "[\""<< name << "\"];" << endl;
+  output << R"([")"<< name << R"("];)" << endl;
 
   writeCShape(output);
   writeCOutputHelper(output, "mean");
@@ -4208,8 +4208,8 @@ CorrPriorStatement::writeOutput(ostream &output, const string &basename, bool mi
 void
 CorrPriorStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"corr_prior\""
-         << ", \"name2\": \"" << name1 << "\"";
+  output << R"({"statementName": "corr_prior")"
+         << R"(, "name2": ")" << name1 << R"(")";
   writeJsonPriorOutput(output);
   output << "}";
 }
@@ -4223,14 +4223,14 @@ CorrPriorStatement::writeCOutput(ostream &output, const string &basename)
     output << "exo_names";
   else
     output << "endo_names";
-  output << "[\""<< name << "\"];" << endl;
+  output << R"([")"<< name << R"("];)" << endl;
 
   output << "index1 = ";
   if (is_structural_innovation(symbol_table.getType(name1)))
     output << "exo_names";
   else
     output << "endo_names";
-  output << "[\""<< name1 << "\"];" << endl;
+  output << R"([")"<< name1 << R"("];)" << endl;
 
   writeCShape(output);
   writeCOutputHelper(output, "mean");
@@ -4351,15 +4351,15 @@ PriorEqualStatement::writeOutput(ostream &output, const string &basename, bool m
 void
 PriorEqualStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"prior_equal\""
-         << ", \"to_name1\": \"" << to_name1 << "\"";
+  output << R"({"statementName": "prior_equal")"
+         << R"(, "to_name1": ")" << to_name1 << R"(")";
   if (to_declaration_type == "corr")
-    output << ", \"to_name2\": \"" << to_name2 << "\"";
-  output << ", \"to_subsample\": \"" << to_subsample_name << "\""
-         << ", \"from_name1\": \"" << from_name1 << "\"";
+    output << R"(, "to_name2": ")" << to_name2 << R"(")";
+  output << R"(, "to_subsample": ")" << to_subsample_name << R"(")"
+         << R"(, "from_name1": ")" << from_name1 << R"(")";
   if (to_declaration_type == "corr")
-    output << ", \"from_name2\": \"" << from_name2 << "\"";
-  output << ", \"from_subsample\": \"" << from_subsample_name << "\""
+    output << R"(, "from_name2": ")" << from_name2 << R"(")";
+  output << R"(, "from_subsample": ")" << from_subsample_name << R"(")"
          << "}";
 }
 
@@ -4439,9 +4439,9 @@ BasicOptionsStatement::writeOptionsOutput(ostream &output, string &lhs_field, co
 void
 BasicOptionsStatement::writeJsonOptionsOutput(ostream &output) const
 {
-  output << ", \"name\": \"" << name << "\"";
+  output << R"(, "name": ")" << name << R"(")";
   if (!subsample_name.empty())
-    output << ", \"subsample_name\": \"" << subsample_name << "\"";
+    output << R"(, "subsample_name": ")" << subsample_name << R"(")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4469,7 +4469,7 @@ OptionsStatement::writeOutput(ostream &output, const string &basename, bool mini
 void
 OptionsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"options\"";
+  output << R"({"statementName": "options")";
   writeJsonOptionsOutput(output);
   output << "}";
 }
@@ -4478,7 +4478,7 @@ void
 OptionsStatement::writeCOutput(ostream &output, const string &basename)
 {
   output << endl
-         << "index = param_names[\""<< name << "\"];" << endl;
+         << R"(index = param_names[")"<< name << R"("];)" << endl;
   writeCOutputHelper(output, "init");
   output << "msdsgeinfo->addOption(new ModFileOption(index, init));" << endl;
 }
@@ -4508,7 +4508,7 @@ StdOptionsStatement::writeOutput(ostream &output, const string &basename, bool m
 void
 StdOptionsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"std_options\"";
+  output << R"({"statementName": "std_options")";
   writeJsonOptionsOutput(output);
   output << "}";
 }
@@ -4522,7 +4522,7 @@ StdOptionsStatement::writeCOutput(ostream &output, const string &basename)
     output << "exo_names";
   else
     output << "endo_names";
-  output << "[\""<< name << "\"];" << endl;
+  output << R"([")"<< name << R"("];)" << endl;
 
   writeCOutputHelper(output, "init");
 
@@ -4573,8 +4573,8 @@ CorrOptionsStatement::writeOutput(ostream &output, const string &basename, bool
 void
 CorrOptionsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"corr_options\""
-         << ", \"name2\": \"" << name1 << "\"";
+  output << R"({"statementName": "corr_options")"
+         << R"(, "name2": ")" << name1 << R"(")";
   writeJsonOptionsOutput(output);
   output << "}";
 }
@@ -4588,14 +4588,14 @@ CorrOptionsStatement::writeCOutput(ostream &output, const string &basename)
     output << "exo_names";
   else
     output << "endo_names";
-  output << "[\""<< name << "\"];" << endl;
+  output << R"([")"<< name << R"("];)" << endl;
 
   output << "index1 = ";
   if (is_structural_innovation(symbol_table.getType(name1)))
     output << "exo_names";
   else
     output << "endo_names";
-  output << "[\""<< name1 << "\"];" << endl;
+  output << R"([")"<< name1 << R"("];)" << endl;
 
   writeCOutputHelper(output, "init");
 
@@ -4641,15 +4641,15 @@ OptionsEqualStatement::checkPass(ModFileStructure &mod_file_struct, WarningConso
 void
 OptionsEqualStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"options_equal\""
-         << ", \"to_name1\": \"" << to_name1 << "\"";
+  output << R"({"statementName": "options_equal")"
+         << R"(, "to_name1": ")" << to_name1 << R"(")";
   if (to_declaration_type == "corr")
-    output << ", \"to_name2\": \"" << to_name2 << "\"";
-  output << ", \"to_subsample\": \"" << to_subsample_name << "\""
-         << ", \"from_name1\": \"" << from_name1 << "\"";
+    output << R"(, "to_name2": ")" << to_name2 << R"(")";
+  output << R"(, "to_subsample": ")" << to_subsample_name << R"(")"
+         << R"(, "from_name1": ")" << from_name1 << R"(")";
   if (to_declaration_type == "corr")
-    output << ", \"from_name2\": \"" << from_name2 << "\"";
-  output << ", \"from_subsample\": \"" << from_subsample_name << "\""
+    output << R"(, "from_name2": ")" << from_name2 << R"(")";
+  output << R"(, "from_subsample": ")" << from_subsample_name << R"(")"
          << "}";
 }
 
@@ -4751,7 +4751,7 @@ CalibSmootherStatement::writeOutput(ostream &output, const string &basename, boo
 void
 CalibSmootherStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"calib_smoother\"";
+  output << R"({"statementName": "calib_smoother")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4803,7 +4803,7 @@ ExtendedPathStatement::writeOutput(ostream &output, const string &basename, bool
 void
 ExtendedPathStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"extended_path\"";
+  output << R"({"statementName": "extended_path")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4821,7 +4821,7 @@ ModelDiagnosticsStatement::writeOutput(ostream &output, const string &basename,
 void
 ModelDiagnosticsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"model_diagnostics\"}";
+  output << R"({"statementName": "model_diagnostics"})";
 }
 
 Smoother2histvalStatement::Smoother2histvalStatement(OptionsList options_list_arg) :
@@ -4839,7 +4839,7 @@ Smoother2histvalStatement::writeOutput(ostream &output, const string &basename,
 void
 Smoother2histvalStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"smoother_2_histval\"";
+  output << R"({"statementName": "smoother_2_histval")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4867,7 +4867,7 @@ GMMEstimationStatement::writeOutput(ostream &output, const string &basename, boo
 void
 GMMEstimationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"gmm_estimation\"";
+  output << R"({"statementName": "gmm_estimation")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4900,7 +4900,7 @@ SMMEstimationStatement::writeOutput(ostream &output, const string &basename, boo
 void
 SMMEstimationStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"smm_estimation\"";
+  output << R"({"statementName": "smm_estimation")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4953,7 +4953,7 @@ GenerateIRFsStatement::writeOutput(ostream &output, const string &basename, bool
 void
 GenerateIRFsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"generate_irfs\"";
+  output << R"({"statementName": "generate_irfs")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
@@ -4962,17 +4962,17 @@ GenerateIRFsStatement::writeJsonOutput(ostream &output) const
 
   if (!generate_irf_names.empty())
     {
-      output << ", \"irf_elements\": [";
+      output << R"(, "irf_elements": [)";
       for (size_t i = 0; i < generate_irf_names.size(); i++)
         {
-          output << "{\"name\": \"" << generate_irf_names[i] << "\", \"shocks\": [";
+          output << R"({"name": ")" << generate_irf_names[i] << R"(", "shocks": [)";
           map<string, double> m = generate_irf_elements[i];
           size_t idx = 0;
           for (map<string, double>::const_iterator it = m.begin();
                it != m.end(); it++, idx++)
             {
-              output << "{\"exogenous_variable\": \"" << it->first << "\", "
-                     << "\"exogenous_variable_value\": \"" << it->second << "\"}";
+              output << R"({"exogenous_variable": ")" << it->first << R"(", )"
+                     << R"("exogenous_variable_value": ")" << it->second << R"("})";
               if (idx + 1 < m.size())
                 output << ", ";
             }
@@ -5094,14 +5094,14 @@ VarExpectationModelStatement::writeOutput(ostream &output, const string &basenam
 void
 VarExpectationModelStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"var_expectation_model\","
-         << "\"model_name\": \"" << model_name << "\", "
-         << "\"expression\": \"";
+  output << R"({"statementName": "var_expectation_model",)"
+         << R"("model_name": ")" << model_name << R"(", )"
+         << R"("expression": ")";
   expression->writeOutput(output);
-  output << "\", "
-         << "\"auxiliary_model_name\": \"" << aux_model_name << "\", "
-         << "\"horizon\": \"" << horizon << "\", "
-         << "\"discount\": \"";
+  output << R"(", )"
+         << R"("auxiliary_model_name": ")" << aux_model_name << R"(", )"
+         << R"("horizon": ")" << horizon << R"(", )"
+         << R"("discount": ")";
   discount->writeOutput(output);
-  output << "\"}";
+  output << R"("})";
 }
diff --git a/src/DataTree.cc b/src/DataTree.cc
index 84b0faaf..cc00fb27 100644
--- a/src/DataTree.cc
+++ b/src/DataTree.cc
@@ -845,7 +845,7 @@ DataTree::writePowerDeriv(ostream &output) const
 string
 DataTree::packageDir(const string &package)
 {
-  regex pat{"\\."};
+  regex pat{R"(\.)"};
   string dirname = "+" + regex_replace(package, pat, "/+");
   boost::filesystem::create_directories(dirname);
   return dirname;
diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index 4674cff9..a5044784 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -974,7 +974,7 @@ DynamicModel::writeModelEquationsCode(const string &basename, const map_idx_t &m
   code_file.open(main_name, ios::out | ios::binary | ios::ate);
   if (!code_file.is_open())
     {
-      cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
+      cerr << R"(Error : Can't open file ")" << main_name << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
 
@@ -1244,7 +1244,7 @@ DynamicModel::writeModelEquationsCode_Block(const string &basename, const map_id
   code_file.open(main_name, ios::out | ios::binary | ios::ate);
   if (!code_file.is_open())
     {
-      cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
+      cerr << R"(Error : Can't open file ")" << main_name << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
   //Temporary variables declaration
@@ -1721,7 +1721,7 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
   if (external_functions_table.get_total_number_of_unique_model_block_external_functions())
     // External Matlab function, implies Dynamic function will call mex
     mDynamicModelFile << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-                      << "#include \"mex.h\"" << endl;
+                      << R"(#include "mex.h")" << endl;
 
   mDynamicModelFile << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
                     << "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
@@ -1758,7 +1758,7 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
                   << endl
                   << "#include <stdlib.h>" << endl
                   << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-                  << "#include \"mex.h\"" << endl
+                  << R"(#include "mex.h")" << endl
                   << endl
                   << "const int ntt = " << ntt << ";" << endl
                   << "void dynamic_resid_tt(const double *y, const double *x, int nb_row_x, const double *params, const double *steady_state, int it_, double *T);" << endl
@@ -1773,7 +1773,7 @@ DynamicModel::writeDynamicCFile(const string &basename, const int order) const
                   << "{" << endl
                   << "  /* Check that no derivatives of higher order than computed are being requested */" << endl
                   << "  if (nlhs > " << order + 1 << ")" << endl
-                  << "    mexErrMsgTxt(\"Derivatives of higher order than computed have been requested\");" << endl
+                  << R"(    mexErrMsgTxt("Derivatives of higher order than computed have been requested");)" << endl
                   << "  /* Create a pointer to the input matrix y. */" << endl
                   << "  double *y = mxGetPr(prhs[0]);" << endl
                   << endl
@@ -1840,16 +1840,16 @@ string
 DynamicModel::reform(const string name1) const
 {
   string name = name1;
-  int pos = name.find("\\", 0);
+  int pos = name.find(R"(\)", 0);
   while (pos >= 0)
     {
-      if (name.substr(pos + 1, 1) != "\\")
+      if (name.substr(pos + 1, 1) != R"(\)")
         {
-          name = name.insert(pos, "\\");
+          name = name.insert(pos, R"(\)");
           pos++;
         }
       pos++;
-      pos = name.find("\\", pos);
+      pos = name.find(R"(\)", pos);
     }
   return (name);
 }
@@ -1910,7 +1910,7 @@ DynamicModel::Write_Inf_To_Bin_File_Block(const string &basename, const int &num
     SaveCode.open(filename, ios::out | ios::binary);
   if (!SaveCode.is_open())
     {
-      cerr << "Error : Can't open file \"" << filename << "\" for writing" << endl;
+      cerr << R"(Error : Can't open file ")" << filename << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
   u_count_int = 0;
@@ -3108,9 +3108,9 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de
       output << modstruct << "equation_tags = [" << endl;
       for (const auto & equation_tag : equation_tags)
         output << "                       EquationTag("
-               << equation_tag.first + 1 << " , \""
-               << equation_tag.second.first << "\" , \""
-               << equation_tag.second.second << "\")" << endl;
+               << equation_tag.first + 1 << R"( , ")"
+               << equation_tag.second.first << R"(" , ")"
+               << equation_tag.second.second << R"("))" << endl;
       output << "                      ]" << endl;
     }
   else
@@ -6716,14 +6716,14 @@ void
 DynamicModel::writeJsonAST(ostream &output) const
 {
   vector<pair<string, string>> eqtags;
-  output << "\"abstract_syntax_tree\":[" << endl;
+  output << R"("abstract_syntax_tree":[)" << endl;
   for (int eq = 0; eq < (int) equations.size(); eq++)
     {
       if (eq != 0)
         output << ", ";
 
-      output << "{ \"number\":" << eq
-             << ", \"line\":" << equations_lineno[eq];
+      output << R"({ "number":)" << eq
+             << R"(, "line":)" << equations_lineno[eq];
 
       for (const auto & equation_tag : equation_tags)
         if (equation_tag.first == eq)
@@ -6731,19 +6731,19 @@ DynamicModel::writeJsonAST(ostream &output) const
 
       if (!eqtags.empty())
         {
-          output << ", \"tags\": {";
+          output << R"(, "tags": {)";
           int i = 0;
           for (vector<pair<string, string>>::const_iterator it = eqtags.begin(); it != eqtags.end(); it++, i++)
             {
               if (i != 0)
                 output << ", ";
-              output << "\"" << it->first << "\": \"" << it->second << "\"";
+              output << R"(")" << it->first << R"(": ")" << it->second << R"(")";
             }
           output << "}";
           eqtags.clear();
         }
 
-      output << ", \"AST\": ";
+      output << R"(, "AST": )";
       equations[eq]->writeJsonAST(output);
       output << "}";
     }
@@ -6758,9 +6758,9 @@ DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, se
     {
       if (it != xrefs.begin())
         output << ", ";
-      output << "{\"name\": \"" << symbol_table.getName(it->first.first) << "\""
-             << ", \"shift\": " << it->first.second
-             << ", \"equations\": [";
+      output << R"({"name": ")" << symbol_table.getName(it->first.first) << R"(")"
+             << R"(, "shift": )" << it->first.second
+             << R"(, "equations": [)";
       for (auto it1 = it->second.begin();
            it1 != it->second.end(); it1++)
         {
@@ -6775,17 +6775,17 @@ DynamicModel::writeJsonXrefsHelper(ostream &output, const map<pair<int, int>, se
 void
 DynamicModel::writeJsonXrefs(ostream &output) const
 {
-  output << "\"xrefs\": {"
-         << "\"parameters\": [";
+  output << R"("xrefs": {)"
+         << R"("parameters": [)";
   writeJsonXrefsHelper(output, xref_param);
   output << "]"
-         << ", \"endogenous\": [";
+         << R"(, "endogenous": [)";
   writeJsonXrefsHelper(output, xref_endo);
   output << "]"
-         << ", \"exogenous\": [";
+         << R"(, "exogenous": [)";
     writeJsonXrefsHelper(output, xref_exo);
   output << "]"
-         << ", \"exogenous_deterministic\": [";
+         << R"(, "exogenous_deterministic": [)";
   writeJsonXrefsHelper(output, xref_exo_det);
   output << "]}" << endl;
 }
@@ -6801,8 +6801,8 @@ DynamicModel::writeJsonOriginalModelOutput(ostream &output) const
 void
 DynamicModel::writeJsonDynamicModelInfo(ostream &output) const
 {
-  output << "\"model_info\": {"
-         << "\"lead_lag_incidence\": [";
+  output << R"("model_info": {)"
+         << R"("lead_lag_incidence": [)";
   // Loop on endogenous variables
   int nstatic = 0,
     nfwrd   = 0,
@@ -6858,13 +6858,13 @@ DynamicModel::writeJsonDynamicModelInfo(ostream &output) const
       output << "]";
     }
   output << "], "
-         << "\"nstatic\": " << nstatic << ", "
-         << "\"nfwrd\": " << nfwrd << ", "
-         << "\"npred\": " << npred << ", "
-         << "\"nboth\": " << nboth << ", "
-         << "\"nsfwrd\": " << nfwrd+nboth << ", "
-         << "\"nspred\": " << npred+nboth << ", "
-         << "\"ndynamic\": " << npred+nboth+nfwrd << endl;
+         << R"("nstatic": )" << nstatic << ", "
+         << R"("nfwrd": )" << nfwrd << ", "
+         << R"("npred": )" << npred << ", "
+         << R"("nboth": )" << nboth << ", "
+         << R"("nsfwrd": )" << nfwrd+nboth << ", "
+         << R"("nspred": )" << npred+nboth << ", "
+         << R"("ndynamic": )" << npred+nboth+nfwrd << endl;
   output << "}";
 }
 
@@ -6896,10 +6896,10 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
   temp_term_union.insert(temporary_terms_derivatives[1].begin(), temporary_terms_derivatives[1].end());
   concat = "jacobian";
   writeJsonTemporaryTerms(temp_term_union, temp_term_union_m_1, jacobian_output, tef_terms, concat);
-  jacobian_output << ", \"jacobian\": {"
-                  << "  \"nrows\": " << equations.size()
-                  << ", \"ncols\": " << dynJacobianColsNbr
-                  << ", \"entries\": [";
+  jacobian_output << R"(, "jacobian": {)"
+                  << R"(  "nrows": )" << equations.size()
+                  << R"(, "ncols": )" << dynJacobianColsNbr
+                  << R"(, "entries": [)";
   for (auto it = derivatives[1].begin();
        it != derivatives[1].end(); it++)
     {
@@ -6912,19 +6912,19 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
       expr_t d1 = it->second;
 
       if (writeDetails)
-        jacobian_output << "{\"eq\": " << eq + 1;
+        jacobian_output << R"({"eq": )" << eq + 1;
       else
-        jacobian_output << "{\"row\": " << eq + 1;
+        jacobian_output << R"({"row": )" << eq + 1;
 
-      jacobian_output << ", \"col\": " << col + 1;
+      jacobian_output << R"(, "col": )" << col + 1;
 
       if (writeDetails)
-        jacobian_output << ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
-                        << ", \"shift\": " << getLagByDerivID(var);
+        jacobian_output << R"(, "var": ")" << symbol_table.getName(getSymbIDByDerivID(var)) << R"(")"
+                        << R"(, "shift": )" << getLagByDerivID(var);
 
-      jacobian_output << ", \"val\": \"";
+      jacobian_output << R"(, "val": ")";
       d1->writeJsonOutput(jacobian_output, temp_term_union, tef_terms);
-      jacobian_output << "\"}" << endl;
+      jacobian_output << R"("})" << endl;
     }
   jacobian_output << "]}";
 
@@ -6933,10 +6933,10 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
   temp_term_union.insert(temporary_terms_derivatives[2].begin(), temporary_terms_derivatives[2].end());
   concat = "hessian";
   writeJsonTemporaryTerms(temp_term_union, temp_term_union_m_1, hessian_output, tef_terms, concat);
-  hessian_output << ", \"hessian\": {"
-                 << "  \"nrows\": " << equations.size()
-                 << ", \"ncols\": " << hessianColsNbr
-                 << ", \"entries\": [";
+  hessian_output << R"(, "hessian": {)"
+                 << R"(  "nrows": )" << equations.size()
+                 << R"(, "ncols": )" << hessianColsNbr
+                 << R"(, "entries": [)";
   for (auto it = derivatives[2].begin();
        it != derivatives[2].end(); it++)
     {
@@ -6952,24 +6952,24 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
       int col_nb_sym = id2 * dynJacobianColsNbr + id1;
 
       if (writeDetails)
-        hessian_output << "{\"eq\": " << eq + 1;
+        hessian_output << R"({"eq": )" << eq + 1;
       else
-        hessian_output << "{\"row\": " << eq + 1;
+        hessian_output << R"({"row": )" << eq + 1;
 
-      hessian_output << ", \"col\": [" << col_nb + 1;
+      hessian_output << R"(, "col": [)" << col_nb + 1;
       if (id1 != id2)
         hessian_output << ", " << col_nb_sym + 1;
       hessian_output << "]";
 
       if (writeDetails)
-        hessian_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
-                       << ", \"shift1\": " << getLagByDerivID(var1)
-                       << ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
-                       << ", \"shift2\": " << getLagByDerivID(var2);
+        hessian_output << R"(, "var1": ")" << symbol_table.getName(getSymbIDByDerivID(var1)) << R"(")"
+                       << R"(, "shift1": )" << getLagByDerivID(var1)
+                       << R"(, "var2": ")" << symbol_table.getName(getSymbIDByDerivID(var2)) << R"(")"
+                       << R"(, "shift2": )" << getLagByDerivID(var2);
 
-      hessian_output << ", \"val\": \"";
+      hessian_output << R"(, "val": ")";
       d2->writeJsonOutput(hessian_output, temp_term_union, tef_terms);
-      hessian_output << "\"}" << endl;
+      hessian_output << R"("})" << endl;
     }
   hessian_output << "]}";
 
@@ -6978,10 +6978,10 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
   temp_term_union.insert(temporary_terms_derivatives[3].begin(), temporary_terms_derivatives[3].end());
   concat = "third_derivatives";
   writeJsonTemporaryTerms(temp_term_union, temp_term_union_m_1, third_derivatives_output, tef_terms, concat);
-  third_derivatives_output << ", \"third_derivative\": {"
-                           << "  \"nrows\": " << equations.size()
-                           << ", \"ncols\": " << hessianColsNbr * dynJacobianColsNbr
-                           << ", \"entries\": [";
+  third_derivatives_output << R"(, "third_derivative": {)"
+                           << R"(  "nrows": )" << equations.size()
+                           << R"(, "ncols": )" << hessianColsNbr * dynJacobianColsNbr
+                           << R"(, "entries": [)";
   for (auto it = derivatives[3].begin();
        it != derivatives[3].end(); it++)
     {
@@ -6993,9 +6993,9 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
       expr_t d3 = it->second;
 
       if (writeDetails)
-        third_derivatives_output << "{\"eq\": " << eq + 1;
+        third_derivatives_output << R"({"eq": )" << eq + 1;
       else
-        third_derivatives_output << "{\"row\": " << eq + 1;
+        third_derivatives_output << R"({"row": )" << eq + 1;
 
       int id1 = getDynJacobianCol(var1);
       int id2 = getDynJacobianCol(var2);
@@ -7008,7 +7008,7 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
       cols.insert(id3 * hessianColsNbr + id1 * dynJacobianColsNbr + id2);
       cols.insert(id3 * hessianColsNbr + id2 * dynJacobianColsNbr + id1);
 
-      third_derivatives_output << ", \"col\": [";
+      third_derivatives_output << R"(, "col": [)";
       for (auto it2 = cols.begin(); it2 != cols.end(); it2++)
         {
           if (it2 != cols.begin())
@@ -7018,23 +7018,23 @@ DynamicModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) c
       third_derivatives_output << "]";
 
       if (writeDetails)
-        third_derivatives_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
-                                 << ", \"shift1\": " << getLagByDerivID(var1)
-                                 << ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
-                                 << ", \"shift2\": " << getLagByDerivID(var2)
-                                 << ", \"var3\": \"" << symbol_table.getName(getSymbIDByDerivID(var3)) << "\""
-                                 << ", \"shift3\": " << getLagByDerivID(var3);
-
-      third_derivatives_output << ", \"val\": \"";
+        third_derivatives_output << R"(, "var1": ")" << symbol_table.getName(getSymbIDByDerivID(var1)) << R"(")"
+                                 << R"(, "shift1": )" << getLagByDerivID(var1)
+                                 << R"(, "var2": ")" << symbol_table.getName(getSymbIDByDerivID(var2)) << R"(")"
+                                 << R"(, "shift2": )" << getLagByDerivID(var2)
+                                 << R"(, "var3": ")" << symbol_table.getName(getSymbIDByDerivID(var3)) << R"(")"
+                                 << R"(, "shift3": )" << getLagByDerivID(var3);
+
+      third_derivatives_output << R"(, "val": ")";
       d3->writeJsonOutput(third_derivatives_output, temp_term_union, tef_terms);
-      third_derivatives_output << "\"}" << endl;
+      third_derivatives_output << R"("})" << endl;
     }
   third_derivatives_output << "]}";
 
   if (writeDetails)
-    output << "\"dynamic_model\": {";
+    output << R"("dynamic_model": {)";
   else
-    output << "\"dynamic_model_simple\": {";
+    output << R"("dynamic_model_simple": {)";
   output << model_local_vars_output.str()
          << ", " << model_output.str()
          << ", " << jacobian_output.str()
@@ -7065,10 +7065,10 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
   for (const auto &it : params_derivs_temporary_terms)
     writeJsonTemporaryTerms(it.second, temp_term_union, model_output, tef_terms, concat);
 
-  jacobian_output << "\"deriv_wrt_params\": {"
-                  << "  \"neqs\": " << equations.size()
-                  << ", \"nparamcols\": " << symbol_table.param_nbr()
-                  << ", \"entries\": [";
+  jacobian_output << R"("deriv_wrt_params": {)"
+                  << R"(  "neqs": )" << equations.size()
+                  << R"(, "nparamcols": )" << symbol_table.param_nbr()
+                  << R"(, "entries": [)";
   auto &rp = params_derivatives.find({ 0, 1 })->second;
   for (auto it = rp.begin(); it != rp.end(); it++)
     {
@@ -7082,26 +7082,26 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
 
       if (writeDetails)
-        jacobian_output << "{\"eq\": " << eq + 1;
+        jacobian_output << R"({"eq": )" << eq + 1;
       else
-        jacobian_output << "{\"row\": " << eq + 1;
+        jacobian_output << R"({"row": )" << eq + 1;
 
-      jacobian_output << ", \"param_col\": " << param_col + 1;
+      jacobian_output << R"(, "param_col": )" << param_col + 1;
 
       if (writeDetails)
-        jacobian_output << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
+        jacobian_output << R"(, "param": ")" << symbol_table.getName(getSymbIDByDerivID(param)) << R"(")";
 
-      jacobian_output << ", \"val\": \"";
+      jacobian_output << R"(, "val": ")";
       d1->writeJsonOutput(jacobian_output, temp_term_union, tef_terms);
-      jacobian_output << "\"}" << endl;
+      jacobian_output << R"("})" << endl;
     }
   jacobian_output << "]}";
 
-  hessian_output << "\"deriv_jacobian_wrt_params\": {"
-                 << "  \"neqs\": " << equations.size()
-                 << ", \"nvarcols\": " << dynJacobianColsNbr
-                 << ", \"nparamcols\": " << symbol_table.param_nbr()
-                 << ", \"entries\": [";
+  hessian_output << R"("deriv_jacobian_wrt_params": {)"
+                 << R"(  "neqs": )" << equations.size()
+                 << R"(, "nvarcols": )" << dynJacobianColsNbr
+                 << R"(, "nparamcols": )" << symbol_table.param_nbr()
+                 << R"(, "entries": [)";
   auto &gp = params_derivatives.find({ 1, 1 })->second;
   for (auto it = gp.begin(); it != gp.end(); it++)
     {
@@ -7116,29 +7116,29 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
 
       if (writeDetails)
-        hessian_output << "{\"eq\": " << eq + 1;
+        hessian_output << R"({"eq": )" << eq + 1;
       else
-        hessian_output << "{\"row\": " << eq + 1;
+        hessian_output << R"({"row": )" << eq + 1;
 
-      hessian_output << ", \"var_col\": " << var_col + 1
-                     << ", \"param_col\": " << param_col + 1;
+      hessian_output << R"(, "var_col": )" << var_col + 1
+                     << R"(, "param_col": )" << param_col + 1;
 
       if (writeDetails)
-      hessian_output << ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
-                     << ", \"lag\": " << getLagByDerivID(var)
-                     << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
+      hessian_output << R"(, "var": ")" << symbol_table.getName(getSymbIDByDerivID(var)) << R"(")"
+                     << R"(, "lag": )" << getLagByDerivID(var)
+                     << R"(, "param": ")" << symbol_table.getName(getSymbIDByDerivID(param)) << R"(")";
 
-      hessian_output << ", \"val\": \"";
+      hessian_output << R"(, "val": ")";
       d2->writeJsonOutput(hessian_output, temp_term_union, tef_terms);
-      hessian_output << "\"}" << endl;
+      hessian_output << R"("})" << endl;
     }
   hessian_output << "]}";
 
-  hessian1_output << "\"second_deriv_residuals_wrt_params\": {"
-                  << "  \"nrows\": " << equations.size()
-                  << ", \"nparam1cols\": " << symbol_table.param_nbr()
-                  << ", \"nparam2cols\": " << symbol_table.param_nbr()
-                  << ", \"entries\": [";
+  hessian1_output << R"("second_deriv_residuals_wrt_params": {)"
+                  << R"(  "nrows": )" << equations.size()
+                  << R"(, "nparam1cols": )" << symbol_table.param_nbr()
+                  << R"(, "nparam2cols": )" << symbol_table.param_nbr()
+                  << R"(, "entries": [)";
   auto &rpp = params_derivatives.find({ 0, 2 })->second;
   for (auto it = rpp.begin(); it != rpp.end(); ++it)
     {
@@ -7153,28 +7153,28 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
 
       if (writeDetails)
-        hessian1_output << "{\"eq\": " << eq + 1;
+        hessian1_output << R"({"eq": )" << eq + 1;
       else
-        hessian1_output << "{\"row\": " << eq + 1;
-      hessian1_output << ", \"param1_col\": " << param1_col + 1
-                      << ", \"param2_col\": " << param2_col + 1;
+        hessian1_output << R"({"row": )" << eq + 1;
+      hessian1_output << R"(, "param1_col": )" << param1_col + 1
+                      << R"(, "param2_col": )" << param2_col + 1;
 
       if (writeDetails)
-        hessian1_output << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
-                        << ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
+        hessian1_output << R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param1)) << R"(")"
+                        << R"(, "param2": ")" << symbol_table.getName(getSymbIDByDerivID(param2)) << R"(")";
 
-      hessian1_output << ", \"val\": \"";
+      hessian1_output << R"(, "val": ")";
       d2->writeJsonOutput(hessian1_output, temp_term_union, tef_terms);
-      hessian1_output << "\"}" << endl;
+      hessian1_output << R"("})" << endl;
     }
   hessian1_output << "]}";
 
-  third_derivs_output << "\"second_deriv_jacobian_wrt_params\": {"
-                      << "  \"neqs\": " << equations.size()
-                      << ", \"nvarcols\": " << dynJacobianColsNbr
-                      << ", \"nparam1cols\": " << symbol_table.param_nbr()
-                      << ", \"nparam2cols\": " << symbol_table.param_nbr()
-                      << ", \"entries\": [";
+  third_derivs_output << R"("second_deriv_jacobian_wrt_params": {)"
+                      << R"(  "neqs": )" << equations.size()
+                      << R"(, "nvarcols": )" << dynJacobianColsNbr
+                      << R"(, "nparam1cols": )" << symbol_table.param_nbr()
+                      << R"(, "nparam2cols": )" << symbol_table.param_nbr()
+                      << R"(, "entries": [)";
   auto &gpp = params_derivatives.find({ 1, 2 })->second;
   for (auto it = gpp.begin(); it != gpp.end(); ++it)
     {
@@ -7190,32 +7190,32 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
 
       if (writeDetails)
-        third_derivs_output << "{\"eq\": " << eq + 1;
+        third_derivs_output << R"({"eq": )" << eq + 1;
       else
-        third_derivs_output << "{\"row\": " << eq + 1;
+        third_derivs_output << R"({"row": )" << eq + 1;
 
-      third_derivs_output << ", \"var_col\": " << var_col + 1
-                          << ", \"param1_col\": " << param1_col + 1
-                          << ", \"param2_col\": " << param2_col + 1;
+      third_derivs_output << R"(, "var_col": )" << var_col + 1
+                          << R"(, "param1_col": )" << param1_col + 1
+                          << R"(, "param2_col": )" << param2_col + 1;
 
       if (writeDetails)
-        third_derivs_output << ", \"var\": \"" << symbol_table.getName(var) << "\""
-                            << ", \"lag\": " << getLagByDerivID(var)
-                            << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
-                            << ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
+        third_derivs_output << R"(, "var": ")" << symbol_table.getName(var) << R"(")"
+                            << R"(, "lag": )" << getLagByDerivID(var)
+                            << R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param1)) << R"(")"
+                            << R"(, "param2": ")" << symbol_table.getName(getSymbIDByDerivID(param2)) << R"(")";
 
-      third_derivs_output << ", \"val\": \"";
+      third_derivs_output << R"(, "val": ")";
       d2->writeJsonOutput(third_derivs_output, temp_term_union, tef_terms);
-      third_derivs_output << "\"}" << endl;
+      third_derivs_output << R"("})" << endl;
     }
   third_derivs_output << "]}" << endl;
 
-  third_derivs1_output << "\"derivative_hessian_wrt_params\": {"
-                       << "  \"neqs\": " << equations.size()
-                       << ", \"nvar1cols\": " << dynJacobianColsNbr
-                       << ", \"nvar2cols\": " << dynJacobianColsNbr
-                       << ", \"nparamcols\": " << symbol_table.param_nbr()
-                       << ", \"entries\": [";
+  third_derivs1_output << R"("derivative_hessian_wrt_params": {)"
+                       << R"(  "neqs": )" << equations.size()
+                       << R"(, "nvar1cols": )" << dynJacobianColsNbr
+                       << R"(, "nvar2cols": )" << dynJacobianColsNbr
+                       << R"(, "nparamcols": )" << symbol_table.param_nbr()
+                       << R"(, "entries": [)";
   auto &hp = params_derivatives.find({ 2, 1 })->second;
   for (auto it = hp.begin(); it != hp.end(); ++it)
     {
@@ -7231,31 +7231,31 @@ DynamicModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
 
       if (writeDetails)
-        third_derivs1_output << "{\"eq\": " << eq + 1;
+        third_derivs1_output << R"({"eq": )" << eq + 1;
       else
-        third_derivs1_output << "{\"row\": " << eq + 1;
+        third_derivs1_output << R"({"row": )" << eq + 1;
 
-      third_derivs1_output << ", \"var1_col\": " << var1_col + 1
-                           << ", \"var2_col\": " << var2_col + 1
-                           << ", \"param_col\": " << param_col + 1;
+      third_derivs1_output << R"(, "var1_col": )" << var1_col + 1
+                           << R"(, "var2_col": )" << var2_col + 1
+                           << R"(, "param_col": )" << param_col + 1;
 
       if (writeDetails)
-        third_derivs1_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
-                             << ", \"lag1\": " << getLagByDerivID(var1)
-                             << ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
-                             << ", \"lag2\": " << getLagByDerivID(var2)
-                             << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
+        third_derivs1_output << R"(, "var1": ")" << symbol_table.getName(getSymbIDByDerivID(var1)) << R"(")"
+                             << R"(, "lag1": )" << getLagByDerivID(var1)
+                             << R"(, "var2": ")" << symbol_table.getName(getSymbIDByDerivID(var2)) << R"(")"
+                             << R"(, "lag2": )" << getLagByDerivID(var2)
+                             << R"(, "param": ")" << symbol_table.getName(getSymbIDByDerivID(param)) << R"(")";
 
-      third_derivs1_output << ", \"val\": \"";
+      third_derivs1_output << R"(, "val": ")";
       d2->writeJsonOutput(third_derivs1_output, temp_term_union, tef_terms);
-      third_derivs1_output << "\"}" << endl;
+      third_derivs1_output << R"("})" << endl;
     }
   third_derivs1_output << "]}" << endl;
 
   if (writeDetails)
-    output << "\"dynamic_model_params_derivative\": {";
+    output << R"("dynamic_model_params_derivative": {)";
   else
-    output << "\"dynamic_model_params_derivatives_simple\": {";
+    output << R"("dynamic_model_params_derivatives_simple": {)";
   output << model_local_vars_output.str()
          << ", " << model_output.str()
          << ", " << jacobian_output.str()
diff --git a/src/DynareMain.cc b/src/DynareMain.cc
index a361f5d5..f9c35528 100644
--- a/src/DynareMain.cc
+++ b/src/DynareMain.cc
@@ -77,12 +77,12 @@ parse_options_line(istream &modfile)
   string first_line;
   getline(modfile, first_line);
 
-  regex pat{"^\\s*//\\s*--\\+\\s*options:([^\\+]*)\\+--"};
+  regex pat{R"(^\s*//\s*--\+\s*options:([^\+]*)\+--)"};
   smatch matches;
   if (regex_search(first_line, matches, pat))
     if (matches.size() > 1 && matches[1].matched)
       {
-        regex pat2{"([^,\\s]+)"};
+        regex pat2{R"(([^,\s]+))"};
         string s{matches[1]};
         for (sregex_iterator p(s.begin(), s.end(), pat2);
              p != sregex_iterator{}; ++p)
diff --git a/src/ExprNode.cc b/src/ExprNode.cc
index 3fdf8326..139ef7a3 100644
--- a/src/ExprNode.cc
+++ b/src/ExprNode.cc
@@ -458,7 +458,7 @@ NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
 void
 NumConstNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"NumConstNode\", \"value\" : ";
+  output << R"({"node_type" : "NumConstNode", "value" : )";
   double testval = datatree.num_constants.getDouble(id);
   if (testval < 1.0 && testval > -1.0 && testval != 0.0)
     output << "0";
@@ -899,8 +899,8 @@ VariableNode::containsExternalFunction() const
 void
 VariableNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"VariableNode\", "
-         << "\"name\" : \"" << datatree.symbol_table.getName(symb_id) << "\", \"type\" : \"";
+  output << R"({"node_type" : "VariableNode", )"
+         << R"("name" : ")" << datatree.symbol_table.getName(symb_id) << R"(", "type" : ")";
   switch (get_type())
     {
     case SymbolType::endogenous:
@@ -943,7 +943,7 @@ VariableNode::writeJsonAST(ostream &output) const
       output << "epilogue";
       break;
     }
-  output << "\", \"lag\" : " << lag << "}";
+  output << R"(", "lag" : )" << lag << "}";
 }
 
 void
@@ -977,7 +977,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
   if (isLatexOutput(output_type))
     {
       if (output_type == ExprNodeOutputType::latexDynamicSteadyStateOperator)
-        output << "\\bar";
+        output << R"(\bar)";
       output << "{" << datatree.symbol_table.getTeXName(symb_id);
       if (output_type == ExprNodeOutputType::latexDynamicModel
           && (type == SymbolType::endogenous || type == SymbolType::exogenous || type == SymbolType::exogenousDet || type == SymbolType::modelLocalVariable || type == SymbolType::trend || type == SymbolType::logTrend))
@@ -2449,7 +2449,7 @@ UnaryOpNode::containsExternalFunction() const
 void
 UnaryOpNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"UnaryOpNode\", \"op\" : \"";
+  output << R"({"node_type" : "UnaryOpNode", "op" : ")";
   switch (op_code)
     {
     case UnaryOpcode::uminus:
@@ -2530,13 +2530,13 @@ UnaryOpNode::writeJsonAST(ostream &output) const
       output << "erf";
       break;
     }
-  output << "\", \"arg\" : ";
+  output << R"(", "arg" : )";
   arg->writeJsonAST(output);
   switch (op_code)
     {
     case UnaryOpcode::adl:
-      output << ", \"adl_param_name\" : \"" << adl_param_name << "\""
-             << ", \"lags\" : [";
+      output << R"(, "adl_param_name" : ")" << adl_param_name << R"(")"
+             << R"(, "lags" : [)";
       for (auto it = adl_lags.begin(); it != adl_lags.end(); it++)
         {
           if (it != adl_lags.begin())
@@ -2728,13 +2728,13 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
       break;
     case UnaryOpcode::log:
       if (isLatexOutput(output_type))
-        output << "\\log";
+        output << R"(\log)";
       else
         output << "log";
       break;
     case UnaryOpcode::log10:
       if (isLatexOutput(output_type))
-        output << "\\log_{10}";
+        output << R"(\log_{10})";
       else
         output << "log10";
       break;
@@ -2846,7 +2846,7 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
           cerr << "UnaryOpNode::writeOutput: not implemented on UnaryOpcode::expectation" << endl;
           exit(EXIT_FAILURE);
         }
-      output << "\\mathbb{E}_{t";
+      output << R"(\mathbb{E}_{t)";
       if (expectation_information_set != 0)
         {
           if (expectation_information_set > 0)
@@ -4400,8 +4400,8 @@ BinaryOpNode::containsExternalFunction() const
 void
 BinaryOpNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"BinaryOpNode\","
-         << " \"op\" : \"";
+  output << R"({"node_type" : "BinaryOpNode",)"
+         << R"( "op" : ")";
   switch (op_code)
     {
     case BinaryOpcode::plus:
@@ -4450,9 +4450,9 @@ BinaryOpNode::writeJsonAST(ostream &output) const
       output << "power_deriv";
       break;
     }
-  output << "\", \"arg1\" : ";
+  output << R"(", "arg1" : )";
   arg1->writeJsonAST(output);
-  output << ", \"arg2\" : ";
+  output << R"(, "arg2" : )";
   arg2->writeJsonAST(output);
   output << "}";
 }
@@ -4646,7 +4646,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
   bool close_parenthesis = false;
 
   if (isLatexOutput(output_type) && op_code == BinaryOpcode::divide)
-    output << "\\frac{";
+    output << R"(\frac{)";
   else
     {
       // If left argument has a lower precedence, or if current and left argument are both power operators, add parenthesis around left argument
@@ -4679,7 +4679,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
       break;
     case BinaryOpcode::times:
       if (isLatexOutput(output_type))
-        output << "\\, ";
+        output << R"(\, )";
       else
         output << "*";
       break;
@@ -4698,13 +4698,13 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
       break;
     case BinaryOpcode::lessEqual:
       if (isLatexOutput(output_type))
-        output << "\\leq ";
+        output << R"(\leq )";
       else
         output << "<=";
       break;
     case BinaryOpcode::greaterEqual:
       if (isLatexOutput(output_type))
-        output << "\\geq ";
+        output << R"(\geq )";
       else
         output << ">=";
       break;
@@ -4719,7 +4719,7 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
           if (isCOutput(output_type) || isJuliaOutput(output_type))
             output << "!=";
           else
-            output << "\\neq ";
+            output << R"(\neq )";
         }
       break;
     case BinaryOpcode::equal:
@@ -6293,8 +6293,8 @@ TrinaryOpNode::containsExternalFunction() const
 void
 TrinaryOpNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"TrinaryOpNode\", "
-         << "\"op\" : \"";
+  output << R"({"node_type" : "TrinaryOpNode", )"
+         << R"("op" : ")";
   switch (op_code)
     {
     case TrinaryOpcode::normcdf:
@@ -6304,11 +6304,11 @@ TrinaryOpNode::writeJsonAST(ostream &output) const
       output << "normpdf";
       break;
     }
-  output << "\", \"arg1\" : ";
+  output << R"(", "arg1" : )";
   arg1->writeJsonAST(output);
-  output << ", \"arg2\" : ";
+  output << R"(, "arg2" : )";
   arg2->writeJsonAST(output);
-  output << ", \"arg2\" : ";
+  output << R"(, "arg2" : )";
   arg3->writeJsonAST(output);
   output << "}";
 }
@@ -7440,7 +7440,7 @@ AbstractExternalFunctionNode::writeJsonASTExternalFunctionArguments(ostream &out
       if (it != arguments.begin())
         output << ",";
 
-      output << "\"arg" << i << "\" : ";
+      output << R"("arg)" << i << R"(" : )";
       (*it)->writeJsonAST(output);
     }
     output << "}";
@@ -7634,8 +7634,8 @@ ExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCode, unsign
 void
 ExternalFunctionNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"ExternalFunctionNode\", "
-         << "\"name\" : \"" << datatree.symbol_table.getName(symb_id) << "\", \"args\" : [";
+  output << R"({"node_type" : "ExternalFunctionNode", )"
+         << R"("name" : ")" << datatree.symbol_table.getName(symb_id) << R"(", "args" : [)";
   writeJsonASTExternalFunctionArguments(output);
   output << "]}";
 }
@@ -7729,8 +7729,8 @@ ExternalFunctionNode::writeExternalFunctionOutput(ostream &output, ExprNodeOutpu
                  << "nlhs" << ending.str() << ", "
                  << "plhs" << ending.str() << ", "
                  << "nrhs" << ending.str() << ", "
-                 << "prhs" << ending.str() << ", \""
-                 << datatree.symbol_table.getName(symb_id) << "\");" << endl;
+                 << "prhs" << ending.str() << R"(, ")"
+                 << datatree.symbol_table.getName(symb_id) << R"(");)" << endl;
 
           if (symb_id == first_deriv_symb_id
               && symb_id == second_deriv_symb_id)
@@ -7781,18 +7781,18 @@ ExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &efout,
       assert(second_deriv_symb_id != ExternalFunctionsTable::IDSetButNoNameProvided);
 
       stringstream ef;
-      ef << "{\"external_function\": {"
-         << "\"external_function_term\": \"TEF_" << indx << "\"";
+      ef << R"({"external_function": {)"
+         << R"("external_function_term": "TEF_)" << indx << R"(")";
 
       if (symb_id == first_deriv_symb_id)
-        ef << ", \"external_function_term_d\": \"TEFD_" << indx << "\"";
+        ef << R"(, "external_function_term_d": "TEFD_)" << indx << R"(")";
 
       if (symb_id == second_deriv_symb_id)
-        ef << ", \"external_function_term_dd\": \"TEFDD_" << indx << "\"";
+        ef << R"(, "external_function_term_dd": "TEFDD_)" << indx << R"(")";
 
-      ef << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "(";
+      ef << R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
       writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms, isdynamic);
-      ef << ")\"}}";
+      ef << R"lit()"}})lit";
       efout.push_back(ef.str());
     }
 }
@@ -7878,8 +7878,8 @@ FirstDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
 void
 FirstDerivExternalFunctionNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"FirstDerivExternalFunctionNode\", "
-         << "\"name\" : \"" << datatree.symbol_table.getName(symb_id) << "\", \"args\" : [";
+  output << R"({"node_type" : "FirstDerivExternalFunctionNode", )"
+         << R"("name" : ")" << datatree.symbol_table.getName(symb_id) << R"(", "args" : [)";
   writeJsonASTExternalFunctionArguments(output);
   output << "]}";
 }
@@ -7923,8 +7923,8 @@ FirstDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType
 
   if (isLatexOutput(output_type))
     {
-      output << "\\frac{\\partial " << datatree.symbol_table.getTeXName(symb_id)
-             << "}{\\partial " << inputIndex << "}(";
+      output << R"(\frac{\partial )" << datatree.symbol_table.getTeXName(symb_id)
+             << R"(}{\partial )" << inputIndex << "}(";
       writeExternalFunctionArguments(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms);
       output << ")";
       return;
@@ -8028,7 +8028,7 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
         output << "dims" << ending.str() << "[0] = 1;" << endl
                << "dims" << ending.str() << "[1] = " << arguments.size() << ";" << endl;
 
-        output << "prhs" << ending.str() << "[0] = mxCreateString(\"" << datatree.symbol_table.getName(symb_id) << "\");" << endl
+        output << "prhs" << ending.str() << R"([0] = mxCreateString(")" << datatree.symbol_table.getName(symb_id) << R"(");)" << endl
                << "prhs" << ending.str() << "[1] = mxCreateDoubleScalar(" << inputIndex << ");"<< endl
                << "prhs" << ending.str() << "[2] = mxCreateCellArray(2, dims" << ending.str() << ");"<< endl;
 
@@ -8046,8 +8046,8 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
                << "nlhs" << ending.str() << ", "
                << "plhs" << ending.str() << ", "
                << "nrhs" << ending.str() << ", "
-               << "prhs" << ending.str() << ", \""
-               << "jacob_element\");" << endl;
+               << "prhs" << ending.str() << R"(, ")"
+               << R"(jacob_element");)" << endl;
 
         output << "TEFD_fdd_" <<  getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex
                << " = mxGetPr(plhs" << ending.str() << "[0]);" << endl;
@@ -8068,8 +8068,8 @@ FirstDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Exp
                << "nlhs" << ending.str() << ", "
                << "plhs" << ending.str() << ", "
                << "nrhs" << ending.str() << ", "
-               << "prhs" << ending.str() << ", \""
-               << datatree.symbol_table.getName(first_deriv_symb_id) << "\");" << endl;
+               << "prhs" << ending.str() << R"(, ")"
+               << datatree.symbol_table.getName(first_deriv_symb_id) << R"(");)" << endl;
 
         output << "TEFD_def_" << indx << " = mxGetPr(plhs" << ending.str() << "[0]);" << endl;
       }
@@ -8116,22 +8116,22 @@ FirstDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string> &
 
   stringstream ef;
   if (first_deriv_symb_id == ExternalFunctionsTable::IDNotSet)
-    ef << "{\"first_deriv_external_function\": {"
-       << "\"external_function_term\": \"TEFD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex << "\""
-       << ", \"analytic_derivative\": false"
-       << ", \"wrt\": " << inputIndex
-       << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "(";
+    ef << R"({"first_deriv_external_function": {)"
+       << R"("external_function_term": "TEFD_fdd_)" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex << R"(")"
+       << R"(, "analytic_derivative": false)"
+       << R"(, "wrt": )" << inputIndex
+       << R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
   else
     {
       tef_terms[{ first_deriv_symb_id, arguments }] = (int) tef_terms.size();
-      ef << "{\"first_deriv_external_function\": {"
-         << "\"external_function_term\": \"TEFD_def_" << getIndxInTefTerms(first_deriv_symb_id, tef_terms) << "\""
-         << ", \"analytic_derivative\": true"
-         << ", \"value\": \"" << datatree.symbol_table.getName(first_deriv_symb_id) << "(";
+      ef << R"({"first_deriv_external_function": {)"
+         << R"("external_function_term": "TEFD_def_)" << getIndxInTefTerms(first_deriv_symb_id, tef_terms) << R"(")"
+         << R"(, "analytic_derivative": true)"
+         << R"(, "value": ")" << datatree.symbol_table.getName(first_deriv_symb_id) << "(";
     }
 
   writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms, isdynamic);
-  ef << ")\"}}";
+  ef << R"lit()"}})lit";
   efout.push_back(ef.str());
 }
 
@@ -8267,8 +8267,8 @@ SecondDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
 void
 SecondDerivExternalFunctionNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"SecondDerivExternalFunctionNode\", "
-         << "\"name\" : \"" << datatree.symbol_table.getName(symb_id) << "\", \"args\" : [";
+  output << R"({"node_type" : "SecondDerivExternalFunctionNode", )"
+         << R"("name" : ")" << datatree.symbol_table.getName(symb_id) << R"(", "args" : [)";
   writeJsonASTExternalFunctionArguments(output);
   output << "]}";
 }
@@ -8313,8 +8313,8 @@ SecondDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType
 
   if (isLatexOutput(output_type))
     {
-      output << "\\frac{\\partial^2 " << datatree.symbol_table.getTeXName(symb_id)
-             << "}{\\partial " << inputIndex1 << "\\partial " << inputIndex2 << "}(";
+      output << R"(\frac{\partial^2 )" << datatree.symbol_table.getTeXName(symb_id)
+             << R"(}{\partial )" << inputIndex1 << R"(\partial )" << inputIndex2 << "}(";
       writeExternalFunctionArguments(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms);
       output << ")";
       return;
@@ -8392,7 +8392,7 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
         output << "dims" << ending.str() << "[0] = 1;" << endl
                << "dims" << ending.str() << "[1] = " << arguments.size() << ";" << endl;
 
-        output << "prhs" << ending.str() << "[0] = mxCreateString(\"" << datatree.symbol_table.getName(symb_id) << "\");" << endl
+        output << "prhs" << ending.str() << R"([0] = mxCreateString(")" << datatree.symbol_table.getName(symb_id) << R"(");)" << endl
                << "prhs" << ending.str() << "[1] = mxCreateDoubleScalar(" << inputIndex1 << ");"<< endl
                << "prhs" << ending.str() << "[2] = mxCreateDoubleScalar(" << inputIndex2 << ");"<< endl
                << "prhs" << ending.str() << "[3] = mxCreateCellArray(2, dims" << ending.str() << ");"<< endl;
@@ -8411,8 +8411,8 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
                << "nlhs" << ending.str() << ", "
                << "plhs" << ending.str() << ", "
                << "nrhs" << ending.str() << ", "
-               << "prhs" << ending.str() << ", \""
-               << "hess_element\");" << endl;
+               << "prhs" << ending.str() << R"(, ")"
+               << R"(hess_element");)" << endl;
 
         output << "TEFDD_fdd_" <<  getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex1 << "_" << inputIndex2
                << " = mxGetPr(plhs" << ending.str() << "[0]);" << endl;
@@ -8434,8 +8434,8 @@ SecondDerivExternalFunctionNode::writeExternalFunctionOutput(ostream &output, Ex
                << "nlhs" << ending.str() << ", "
                << "plhs" << ending.str() << ", "
                << "nrhs" << ending.str() << ", "
-               << "prhs" << ending.str() << ", \""
-               << datatree.symbol_table.getName(second_deriv_symb_id) << "\");" << endl;
+               << "prhs" << ending.str() << R"(, ")"
+               << datatree.symbol_table.getName(second_deriv_symb_id) << R"(");)" << endl;
 
         output << "TEFDD_def_" << indx << " = mxGetPr(plhs" << ending.str() << "[0]);" << endl;
       }
@@ -8483,23 +8483,23 @@ SecondDerivExternalFunctionNode::writeJsonExternalFunctionOutput(vector<string>
 
   stringstream ef;
   if (second_deriv_symb_id == ExternalFunctionsTable::IDNotSet)
-    ef << "{\"second_deriv_external_function\": {"
-       << "\"external_function_term\": \"TEFDD_fdd_" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex1 << "_" << inputIndex2 << "\""
-       << ", \"analytic_derivative\": false"
-       << ", \"wrt1\": " << inputIndex1
-       << ", \"wrt2\": " << inputIndex2
-       << ", \"value\": \"" << datatree.symbol_table.getName(symb_id) << "(";
+    ef << R"({"second_deriv_external_function": {)"
+       << R"("external_function_term": "TEFDD_fdd_)" << getIndxInTefTerms(symb_id, tef_terms) << "_" << inputIndex1 << "_" << inputIndex2 << R"(")"
+       << R"(, "analytic_derivative": false)"
+       << R"(, "wrt1": )" << inputIndex1
+       << R"(, "wrt2": )" << inputIndex2
+       << R"(, "value": ")" << datatree.symbol_table.getName(symb_id) << "(";
   else
     {
       tef_terms[{ second_deriv_symb_id, arguments }] = (int) tef_terms.size();
-      ef << "{\"second_deriv_external_function\": {"
-         << "\"external_function_term\": \"TEFDD_def_" << getIndxInTefTerms(second_deriv_symb_id, tef_terms) << "\""
-         << ", \"analytic_derivative\": true"
-         << ", \"value\": \"" << datatree.symbol_table.getName(second_deriv_symb_id) << "(";
+      ef << R"({"second_deriv_external_function": {)"
+         << R"("external_function_term": "TEFDD_def_)" << getIndxInTefTerms(second_deriv_symb_id, tef_terms) << R"(")"
+         << R"(, "analytic_derivative": true)"
+         << R"(, "value": ")" << datatree.symbol_table.getName(second_deriv_symb_id) << "(";
     }
 
   writeJsonExternalFunctionArguments(ef, temporary_terms, tef_terms, isdynamic);
-  ef << ")\"}}" << endl;
+  ef << R"lit()"}})lit" << endl;
   efout.push_back(ef.str());
 }
 
@@ -9012,8 +9012,8 @@ VarExpectationNode::replaceVarsInEquation(map<VariableNode *, NumConstNode *> &t
 void
 VarExpectationNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"VarExpectationNode\", "
-         << "\"name\" : \"" << model_name << "\"}";
+  output << R"({"node_type" : "VarExpectationNode", )"
+         << R"("name" : ")" << model_name << R"("})";
 }
 
 void
@@ -9416,8 +9416,8 @@ PacExpectationNode::replaceVarsInEquation(map<VariableNode *, NumConstNode *> &t
 void
 PacExpectationNode::writeJsonAST(ostream &output) const
 {
-  output << "{\"node_type\" : \"PacExpectationNode\", "
-         << "\"name\" : \"" << model_name << "\"}";
+  output << R"({"node_type" : "PacExpectationNode", )"
+         << R"("name" : ")" << model_name << R"("})";
 }
 
 void
diff --git a/src/ModFile.cc b/src/ModFile.cc
index 542a9409..ce5867f4 100644
--- a/src/ModFile.cc
+++ b/src/ModFile.cc
@@ -301,7 +301,7 @@ ModFile::checkPass(bool nostrict, bool stochastic)
           || dynamic_model.isBinaryOpUsed(BinaryOpcode::lessEqual)
           || dynamic_model.isBinaryOpUsed(BinaryOpcode::equalEqual)
           || dynamic_model.isBinaryOpUsed(BinaryOpcode::different)))
-    warnings << "WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about \"Expressions\", for more details." << endl;
+    warnings << R"(WARNING: you are using a function (max, min, abs, sign) or an operator (<, >, <=, >=, ==, !=) which is unsuitable for a stochastic context; see the reference manual, section about "Expressions", for more details.)" << endl;
 
   if (linear
       && (dynamic_model.isUnaryOpUsed(UnaryOpcode::sign)
@@ -944,7 +944,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo
       mOutputFile << "options_.parallel_info.local_files = {" << endl;
       for (const auto & parallel_local_file : parallel_local_files)
         {
-          size_t j = parallel_local_file.find_last_of("/\\");
+          size_t j = parallel_local_file.find_last_of(R"(/\)");
           if (j == string::npos)
             mOutputFile << "'', '" << parallel_local_file << "';" << endl;
           else
@@ -1158,10 +1158,10 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
                << "using SteadyState" << endl << endl
                << "using " << basename << "Static" << endl
                << "using " << basename << "Dynamic" << endl
-               << "if isfile(\"" << basename << "SteadyState.jl"  "\")" << endl
+               << R"(if isfile(")" << basename << R"(SteadyState.jl"))" << endl
                << "    using " << basename << "SteadyState" << endl
                << "end" << endl
-               << "if isfile(\"" << basename << "SteadyState2.jl"  "\")" << endl
+               << R"(if isfile(")" << basename << R"(SteadyState2.jl"))" << endl
                << "    using " << basename << "SteadyState2" << endl
                << "end" << endl << endl
                << "export model_, options_, oo_" << endl;
@@ -1169,20 +1169,20 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
   // Write Output
   jlOutputFile << endl
                << "oo_ = dynare_output()" << endl
-               << "oo_.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl;
+               << R"(oo_.dynare_version = ")" << PACKAGE_VERSION << R"(")" << endl;
 
   // Write Options
   jlOutputFile << endl
                << "options_ = dynare_options()" << endl
-               << "options_.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl;
+               << R"(options_.dynare_version = ")" << PACKAGE_VERSION << R"(")" << endl;
   if (linear == 1)
     jlOutputFile << "options_.linear = true" << endl;
 
   // Write Model
   jlOutputFile << endl
                << "model_ = dynare_model()" << endl
-               << "model_.fname = \"" << basename << "\"" << endl
-               << "model_.dynare_version = \"" << PACKAGE_VERSION << "\"" << endl
+               << R"(model_.fname = ")" << basename << R"(")" << endl
+               << R"(model_.dynare_version = ")" << PACKAGE_VERSION << R"(")" << endl
                << "model_.sigma_e = zeros(Float64, " << symbol_table.exo_nbr() << ", "
                << symbol_table.exo_nbr() << ")" << endl
                << "model_.correlation_matrix = ones(Float64, " << symbol_table.exo_nbr() << ", "
@@ -1229,19 +1229,19 @@ ModFile::writeExternalFilesJulia(const string &basename, FileOutputType output)
                << "model_.dynamic = " << basename << "Dynamic.dynamic!" << endl
                << "model_.temporaries.static = " << basename << "Static.tmp_nbr" << endl
                << "model_.temporaries.dynamic = " << basename << "Dynamic.tmp_nbr" << endl
-               << "if isfile(\"" << basename << "SteadyState.jl"  "\")" << endl
+               << R"(if isfile(")" << basename << R"(SteadyState.jl"))" << endl
                << "    model_.user_written_analytical_steady_state = true" << endl
                << "    model_.steady_state = " << basename << "SteadyState.steady_state!" << endl
                << "end" << endl
-               << "if isfile(\"" << basename << "SteadyState2.jl"  "\")" << endl
+               << R"(if isfile(")" << basename << R"(SteadyState2.jl"))" << endl
                << "    model_.analytical_steady_state = true" << endl
                << "    model_.steady_state = " << basename << "SteadyState2.steady_state!" << endl
                << "end" << endl
-               << "if isfile(\"" << basename << "StaticParamsDerivs.jl"  "\")" << endl
+               << R"(if isfile(")" << basename << R"(StaticParamsDerivs.jl"))" << endl
                << "    using " << basename << "StaticParamsDerivs" << endl
                << "    model_.static_params_derivs = " << basename << "StaticParamsDerivs.params_derivs" << endl
                << "end" << endl
-               << "if isfile(\"" << basename << "DynamicParamsDerivs.jl"  "\")" << endl
+               << R"(if isfile(")" << basename << R"(DynamicParamsDerivs.jl"))" << endl
                << "    using " << basename << "DynamicParamsDerivs" << endl
                << "    model_.dynamic_params_derivs = " << basename << "DynamicParamsDerivs.params_derivs" << endl
                << "end" << endl
@@ -1312,7 +1312,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
       || !var_model_table.empty()
       || !trend_component_model_table.empty())
     {
-      output << ", \"statements\": [";
+      output << R"(, "statements": [)";
       if (!var_model_table.empty())
         {
           var_model_table.writeJsonOutput(output);
@@ -1350,7 +1350,7 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
       original_model.writeJsonOriginalModelOutput(original_model_output);
       if (!statements.empty() || !var_model_table.empty() || !trend_component_model_table.empty())
         {
-          original_model_output << endl << ", \"statements\": [";
+          original_model_output << endl << R"(, "statements": [)";
           if (!var_model_table.empty())
             {
               var_model_table.writeJsonOutput(original_model_output);
@@ -1381,14 +1381,14 @@ ModFile::writeJsonOutputParsingCheck(const string &basename, JsonFileOutputType
   if (json_output_mode == JsonFileOutputType::standardout)
     {
       if (transformpass || computingpass)
-        cout << "\"transformed_modfile\": ";
+        cout << R"("transformed_modfile": )";
       else
-        cout << "\"modfile\": ";
+        cout << R"("modfile": )";
       cout << output.str();
       if (!original_model_output.str().empty())
-        cout << ", \"original_model\": " << original_model_output.str();
+        cout << R"(, "original_model": )" << original_model_output.str();
       if (!steady_state_model_output.str().empty())
-        cout << ", \"steady_state_model\": " << steady_state_model_output.str();
+        cout << R"(, "steady_state_model": )" << steady_state_model_output.str();
     }
   else
     {
@@ -1492,14 +1492,14 @@ ModFile::writeJsonComputingPassOutput(const string &basename, JsonFileOutputType
 
   if (json_output_mode == JsonFileOutputType::standardout)
     {
-      cout << ", \"static_model\": " << static_output.str() << endl
-           << ", \"dynamic_model\": " << dynamic_output.str() << endl;
+      cout << R"(, "static_model": )" << static_output.str() << endl
+           << R"(, "dynamic_model": )" << dynamic_output.str() << endl;
 
       if (!static_paramsd_output.str().empty())
-        cout << ", \"static_params_deriv\": " << static_paramsd_output.str() << endl;
+        cout << R"(, "static_params_deriv": )" << static_paramsd_output.str() << endl;
 
       if (!dynamic_paramsd_output.str().empty())
-        cout << ", \"dynamic_params_deriv\": " << dynamic_paramsd_output.str() << endl;
+        cout << R"(, "dynamic_params_deriv": )" << dynamic_paramsd_output.str() << endl;
     }
   else
     {
diff --git a/src/ModelTree.cc b/src/ModelTree.cc
index febb1e68..9db06a0f 100644
--- a/src/ModelTree.cc
+++ b/src/ModelTree.cc
@@ -1434,7 +1434,7 @@ ModelTree::writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_
   bool wrote_term = false;
   temporary_terms_t tt2 = ttm1;
 
-  output << "\"external_functions_temporary_terms_" << concat << "\": [";
+  output << R"("external_functions_temporary_terms_)" << concat << R"(": [)";
   for (auto it : tt)
     if (ttm1.find(it) == ttm1.end())
       {
@@ -1458,19 +1458,19 @@ ModelTree::writeJsonTemporaryTerms(const temporary_terms_t &tt, const temporary_
   tt2 = ttm1;
   wrote_term = false;
   output << "]"
-         << ", \"temporary_terms_" << concat << "\": [";
+         << R"(, "temporary_terms_)" << concat << R"(": [)";
   for (auto it = tt.begin();
        it != tt.end(); it++)
     if (ttm1.find(*it) == ttm1.end())
       {
         if (wrote_term)
           output << ", ";
-        output << "{\"temporary_term\": \"";
+        output << R"({"temporary_term": ")";
         (*it)->writeJsonOutput(output, tt, tef_terms);
-        output << "\""
-               << ", \"value\": \"";
+        output << R"(")"
+               << R"(, "value": ")";
         (*it)->writeJsonOutput(output, tt2, tef_terms);
-        output << "\"}" << endl;
+        output << R"("})" << endl;
         wrote_term = true;
 
         // Insert current node into tt2
@@ -1647,7 +1647,7 @@ ModelTree::writeJsonModelLocalVariables(ostream &output, deriv_node_temp_terms_t
   for (auto equation : equations)
     equation->collectVariables(SymbolType::modelLocalVariable, used_local_vars);
 
-  output << "\"model_local_variables\": [";
+  output << R"("model_local_variables": [)";
   bool printed = false;
   for (int it : local_variables_vector)
     if (used_local_vars.find(it) != used_local_vars.end())
@@ -1673,10 +1673,10 @@ ModelTree::writeJsonModelLocalVariables(ostream &output, deriv_node_temp_terms_t
 
         /* We append underscores to avoid name clashes with "g1" or "oo_" (see
            also VariableNode::writeOutput) */
-        output << "{\"variable\": \"" << symbol_table.getName(id) << "__\""
-               << ", \"value\": \"";
+        output << R"({"variable": ")" << symbol_table.getName(id) << R"(__")"
+               << R"(, "value": ")";
         value->writeJsonOutput(output, tt, tef_terms);
-        output << "\"}" << endl;
+        output << R"("})" << endl;
       }
   output << "]";
 }
@@ -1800,7 +1800,7 @@ ModelTree::Write_Inf_To_Bin_File(const string &filename,
     SaveCode.open(filename, ios::out | ios::binary);
   if (!SaveCode.is_open())
     {
-      cerr << "Error : Can't open file \"" << filename << "\" for writing" << endl;
+      cerr << R"(Error : Can't open file ")" << filename << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
   u_count_int = 0;
@@ -1852,24 +1852,24 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
       exit(EXIT_FAILURE);
     }
 
-  output << "\\documentclass[10pt,a4paper]{article}" << endl
-         << "\\usepackage[landscape]{geometry}" << endl
-         << "\\usepackage{fullpage}" << endl
-         << "\\usepackage{amsfonts}" << endl
-         << "\\usepackage{breqn}" << endl
-         << "\\begin{document}" << endl
-         << "\\footnotesize" << endl;
+  output << R"(\documentclass[10pt,a4paper]{article})" << endl
+         << R"(\usepackage[landscape]{geometry})" << endl
+         << R"(\usepackage{fullpage})" << endl
+         << R"(\usepackage{amsfonts})" << endl
+         << R"(\usepackage{breqn})" << endl
+         << R"(\begin{document})" << endl
+         << R"(\footnotesize)" << endl;
 
   // Write model local variables
   for (int id : local_variables_vector)
     {
       expr_t value = local_variables_table.find(id)->second;
 
-      content_output << "\\begin{dmath*}" << endl
+      content_output << R"(\begin{dmath*})" << endl
                      << symbol_table.getTeXName(id) << " = ";
       // Use an empty set for the temporary terms
       value->writeOutput(content_output, output_type);
-      content_output << endl << "\\end{dmath*}" << endl;
+      content_output << endl << R"(\end{dmath*})" << endl;
     }
 
   for (int eq = 0; eq < (int) equations.size(); eq++)
@@ -1882,7 +1882,7 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
             if (equation_tag.first == eq)
               {
                 if (!wrote_eq_tag)
-                  content_output << "\\noindent[";
+                  content_output << R"(\noindent[)";
                 else
                   content_output << ", ";
 
@@ -1898,14 +1898,14 @@ ModelTree::writeLatexModelFile(const string &basename, ExprNodeOutputType output
             content_output << "]";
         }
 
-      content_output << "\\begin{dmath}" << endl;
+      content_output << R"(\begin{dmath})" << endl;
       // Here it is necessary to cast to superclass ExprNode, otherwise the overloaded writeOutput() method is not found
       dynamic_cast<ExprNode *>(equations[eq])->writeOutput(content_output, output_type);
-      content_output << endl << "\\end{dmath}" << endl;
+      content_output << endl << R"(\end{dmath})" << endl;
     }
 
-  output << "\\include{" << content_basename << "}" << endl
-         << "\\end{document}" << endl;
+  output << R"(\include{)" << content_basename << "}" << endl
+         << R"(\end{document})" << endl;
 
   output.close();
   content_output.close();
@@ -2114,9 +2114,9 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
   vector<pair<string, string>> eqtags;
   temporary_terms_t tt_empty;
   if (residuals)
-    output << endl << "\"residuals\":[" << endl;
+    output << endl << R"("residuals":[)" << endl;
   else
-    output << endl << "\"model\":[" << endl;
+    output << endl << R"("model":[)" << endl;
   for (int eq = 0; eq < (int) equations.size(); eq++)
     {
       if (eq > 0)
@@ -2128,22 +2128,22 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
 
       if (residuals)
         {
-          output << "{\"residual\": {"
-                 << "\"lhs\": \"";
+          output << R"({"residual": {)"
+                 << R"("lhs": ")";
           lhs->writeJsonOutput(output, temporary_terms, {});
-          output << "\"";
+          output << R"(")";
 
-          output << ", \"rhs\": \"";
+          output << R"(, "rhs": ")";
           rhs->writeJsonOutput(output, temporary_terms, {});
-          output << "\"";
+          output << R"(")";
           try
             {
               // Test if the right hand side of the equation is empty.
               if (rhs->eval(eval_context_t()) != 0)
                 {
-                  output << ", \"rhs\": \"";
+                  output << R"(, "rhs": ")";
                   rhs->writeJsonOutput(output, temporary_terms, {});
-                  output << "\"";
+                  output << R"(")";
                 }
             }
           catch (ExprNode::EvalException &e)
@@ -2153,12 +2153,12 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
         }
       else
         {
-          output << "{\"lhs\": \"";
+          output << R"({"lhs": ")";
           lhs->writeJsonOutput(output, tt_empty, {});
-          output << "\", \"rhs\": \"";
+          output << R"(", "rhs": ")";
           rhs->writeJsonOutput(output, tt_empty, {});
-          output << "\""
-                 << ", \"line\": " << equations_lineno[eq];
+          output << R"(")"
+                 << R"(, "line": )" << equations_lineno[eq];
 
           for (const auto & equation_tag : equation_tags)
             if (equation_tag.first == eq)
@@ -2166,13 +2166,13 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
 
           if (!eqtags.empty())
             {
-              output << ", \"tags\": {";
+              output << R"(, "tags": {)";
               int i = 0;
               for (vector<pair<string, string>>::const_iterator it = eqtags.begin(); it != eqtags.end(); it++, i++)
                 {
                   if (i != 0)
                     output << ", ";
-                  output << "\"" << it->first << "\": \"" << it->second << "\"";
+                  output << R"(")" << it->first << R"(": ")" << it->second << R"(")";
                 }
               output << "}";
               eqtags.clear();
diff --git a/src/NumericalInitialization.cc b/src/NumericalInitialization.cc
index 9c6a9fb2..6eebb43b 100644
--- a/src/NumericalInitialization.cc
+++ b/src/NumericalInitialization.cc
@@ -67,9 +67,9 @@ InitParamStatement::writeJuliaOutput(ostream &output, const string &basename)
 void
 InitParamStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"param_init\", \"name\": \"" << symbol_table.getName(symb_id) << "\", " << "\"value\": \"";
+  output << R"({"statementName": "param_init", "name": ")" << symbol_table.getName(symb_id) << R"(", )" << R"("value": ")";
   param_value->writeJsonOutput(output, {}, {});
-  output << "\"}";
+  output << R"("})";
 }
 
 void
@@ -179,9 +179,9 @@ InitOrEndValStatement::writeJsonInitValues(ostream &output) const
     {
       if (it != init_values.begin())
         output << ", ";
-      output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", " << "\"value\": \"";
+      output << R"({"name": ")" << symbol_table.getName(it->first) << R"(", )" << R"("value": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
 }
 
@@ -233,7 +233,7 @@ InitValStatement::writeOutput(ostream &output, const string &basename, bool mini
 void
 InitValStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"initval\", \"vals\": [";
+  output << R"({"statementName": "initval", "vals": [)";
   writeJsonInitValues(output);
   output << "]}";
 }
@@ -298,7 +298,7 @@ EndValStatement::writeOutput(ostream &output, const string &basename, bool minim
 void
 EndValStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"endval\", \"vals\": [";
+  output << R"({"statementName": "endval", "vals": [)";
   writeJsonInitValues(output);
   output << "]}";
 }
@@ -394,17 +394,17 @@ HistValStatement::writeOutput(ostream &output, const string &basename, bool mini
 void
 HistValStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"histval\", \"vals\": [";
+  output << R"({"statementName": "histval", "vals": [)";
   for (auto it = hist_values.begin();
        it != hist_values.end(); it++)
     {
       if (it != hist_values.begin())
         output << ", ";
-      output << "{ \"name\": \"" << symbol_table.getName(it->first.first) << "\""
-             << ", \"lag\": " << it->first.second
-             << ", \"value\": \"";
+      output << R"({ "name": ")" << symbol_table.getName(it->first.first) << R"(")"
+             << R"(, "lag": )" << it->first.second
+             << R"(, "value": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]}";
 }
@@ -427,8 +427,8 @@ InitvalFileStatement::writeOutput(ostream &output, const string &basename, bool
 void
 InitvalFileStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"init_val_file\""
-         << ", \"filename\": \"" << filename << "\""
+  output << R"({"statementName": "init_val_file")"
+         << R"(, "filename": ")" << filename << R"(")"
          << "}";
 }
 
@@ -446,8 +446,8 @@ HistvalFileStatement::writeOutput(ostream &output, const string &basename, bool
 void
 HistvalFileStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"hist_val_file\""
-         << ", \"filename\": \"" << filename << "\""
+  output << R"({"statementName": "hist_val_file")"
+         << R"(, "filename": ")" << filename << R"(")"
          << "}";
 }
 
@@ -489,8 +489,8 @@ HomotopyStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 HomotopyStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"homotopy\", "
-         << "\"values\": [";
+  output << R"({"statementName": "homotopy", )"
+         << R"("values": [)";
   for (auto it = homotopy_values.begin();
        it != homotopy_values.end(); ++it)
     {
@@ -501,15 +501,15 @@ HomotopyStatement::writeJsonOutput(ostream &output) const
       expr_t expression1, expression2;
       tie(symb_id, expression1, expression2) = *it;
 
-      output << "{\"name\": \"" << symbol_table.getName(symb_id) << "\""
-             << ", \"initial_value\": \"";
+      output << R"({"name": ")" << symbol_table.getName(symb_id) << R"(")"
+             << R"(, "initial_value": ")";
       if (expression1)
         expression1->writeJsonOutput(output, {}, {});
       else
         output << "NaN";
-      output << "\", \"final_value\": \"";
+      output << R"(", "final_value": ")";
       expression2->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
          << "}";
@@ -529,8 +529,8 @@ SaveParamsAndSteadyStateStatement::writeOutput(ostream &output, const string &ba
 void
 SaveParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"save_params_and_steady_state\""
-         << ", \"filename\": \"" << filename << "\""
+  output << R"({"statementName": "save_params_and_steady_state")"
+         << R"(, "filename": ")" << filename << R"(")"
          << "}";
 }
 
@@ -601,15 +601,15 @@ LoadParamsAndSteadyStateStatement::writeOutput(ostream &output, const string &ba
 void
 LoadParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"load_params_and_steady_state\""
-         << "\"values\": [";
+  output << R"({"statementName": "load_params_and_steady_state")"
+         << R"("values": [)";
   for (auto it = content.begin();
        it != content.end(); it++)
     {
       if (it != content.begin())
         output << ", ";
-      output << "{\"name\": \"" << symbol_table.getName(it->first) << "\""
-             << ", \"value\": \"" << it->second << "\"}";
+      output << R"({"name": ")" << symbol_table.getName(it->first) << R"(")"
+             << R"(, "value": ")" << it->second << R"("})";
     }
   output << "]"
          << "}";
diff --git a/src/Shocks.cc b/src/Shocks.cc
index e377984f..a07b3960 100644
--- a/src/Shocks.cc
+++ b/src/Shocks.cc
@@ -70,24 +70,24 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
 void
 AbstractShocksStatement::writeJsonDetShocks(ostream &output) const
 {
-  output << "\"deterministic_shocks\": [";
+  output << R"("deterministic_shocks": [)";
   for (auto it = det_shocks.begin();
        it != det_shocks.end(); it++)
     {
       if (it != det_shocks.begin())
         output << ", ";
-      output << "{\"var\": \"" << symbol_table.getName(it->first) << "\", "
-             << "\"values\": [";
+      output << R"({"var": ")" << symbol_table.getName(it->first) << R"(", )"
+             << R"("values": [)";
       for (auto it1 = it->second.begin();
            it1 != it->second.end(); it1++)
         {
           if (it1 != it->second.begin())
             output << ", ";
-          output << "{\"period1\": " << it1->period1 << ", "
-                 << "\"period2\": " << it1->period2 << ", "
-                 << "\"value\": \"";
+          output << R"({"period1": )" << it1->period1 << ", "
+                 << R"("period2": )" << it1->period2 << ", "
+                 << R"("value": ")";
           it1->value->writeJsonOutput(output, {}, {});
-          output << "\"}";
+          output << R"("})";
         }
       output << "]}";
     }
@@ -153,8 +153,8 @@ ShocksStatement::writeOutput(ostream &output, const string &basename, bool minim
 void
 ShocksStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"shocks\""
-         << ", \"overwrite\": ";
+  output << R"({"statementName": "shocks")"
+         << R"(, "overwrite": )";
   if (overwrite)
     output << "true";
   else
@@ -164,52 +164,52 @@ ShocksStatement::writeJsonOutput(ostream &output) const
       output << ", ";
       writeJsonDetShocks(output);
     }
-  output<< ", \"variance\": [";
+  output<< R"(, "variance": [)";
   for (auto it = var_shocks.begin(); it != var_shocks.end(); it++)
     {
       if (it != var_shocks.begin())
         output << ", ";
-      output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", "
-             << "\"variance\": \"";
+      output << R"({"name": ")" << symbol_table.getName(it->first) << R"(", )"
+             << R"("variance": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
-         << ", \"stderr\": [";
+         << R"(, "stderr": [)";
   for (auto it = std_shocks.begin(); it != std_shocks.end(); it++)
     {
       if (it != std_shocks.begin())
         output << ", ";
-      output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", "
-             << "\"stderr\": \"";
+      output << R"({"name": ")" << symbol_table.getName(it->first) << R"(", )"
+             << R"("stderr": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
-         << ", \"covariance\": [";
+         << R"(, "covariance": [)";
   for (auto it = covar_shocks.begin(); it != covar_shocks.end(); it++)
     {
       if (it != covar_shocks.begin())
         output << ", ";
       output << "{"
-             << "\"name\": \"" << symbol_table.getName(it->first.first) << "\", "
-             << "\"name2\": \"" << symbol_table.getName(it->first.second) << "\", "
-             << "\"covariance\": \"";
+             << R"("name": ")" << symbol_table.getName(it->first.first) << R"(", )"
+             << R"("name2": ")" << symbol_table.getName(it->first.second) << R"(", )"
+             << R"("covariance": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
-         << ", \"correlation\": [";
+         << R"(, "correlation": [)";
   for (auto it = corr_shocks.begin(); it != corr_shocks.end(); it++)
     {
       if (it != corr_shocks.begin())
         output << ", ";
       output << "{"
-             << "\"name\": \"" << symbol_table.getName(it->first.first) << "\", "
-             << "\"name2\": \"" << symbol_table.getName(it->first.second) << "\", "
-             << "\"correlation\": \"";
+             << R"("name": ")" << symbol_table.getName(it->first.first) << R"(", )"
+             << R"("name2": ")" << symbol_table.getName(it->first.second) << R"(", )"
+             << R"("correlation": ")";
       it->second->writeJsonOutput(output, {}, {});
-      output << "\"}";
+      output << R"("})";
     }
   output << "]"
          << "}";
@@ -487,23 +487,23 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
 void
 ConditionalForecastPathsStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"conditional_forecast_paths\""
-         << ", \"paths\": [";
+  output << R"({"statementName": "conditional_forecast_paths")"
+         << R"(, "paths": [)";
   for (auto it = paths.begin(); it != paths.end(); it++)
     {
       if (it != paths.begin())
         output << ", ";
-      output << "{\"var\": \"" << symbol_table.getName(it->first) << "\", "
-             << "\"values\": [";
+      output << R"({"var": ")" << symbol_table.getName(it->first) << R"(", )"
+             << R"("values": [)";
       for (auto it1 = it->second.begin(); it1 != it->second.end(); it1++)
         {
           if (it1 != it->second.begin())
             output << ", ";
-          output << "{\"period1\": " << it1->period1 << ", "
-                 << "\"period2\": " << it1->period2 << ", "
-                 << "\"value\": \"";
+          output << R"({"period1": )" << it1->period1 << ", "
+                 << R"("period2": )" << it1->period2 << ", "
+                 << R"("value": ")";
           it1->value->writeJsonOutput(output, {}, {});
-          output << "\"}";
+          output << R"("})";
         }
       output << "]}";
     }
@@ -534,17 +534,17 @@ MomentCalibration::writeOutput(ostream &output, const string &basename, bool min
 void
 MomentCalibration::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"moment_calibration\""
-         << ", \"moment_calibration_criteria\": [";
+  output << R"({"statementName": "moment_calibration")"
+         << R"(, "moment_calibration_criteria": [)";
   for (auto it = constraints.begin(); it != constraints.end(); it++)
     {
       if (it != constraints.begin())
         output << ", ";
-      output << "{\"endogenous1\": \"" << symbol_table.getName(it->endo1) << "\""
-             << ", \"endogenous2\": \"" << symbol_table.getName(it->endo2) << "\""
-             << ", \"lags\": \"" << it->lags << "\""
-             << ", \"lower_bound\": \"" << it->lower_bound << "\""
-             << ", \"upper_bound\": \"" << it->upper_bound << "\""
+      output << R"({"endogenous1": ")" << symbol_table.getName(it->endo1) << R"(")"
+             << R"(, "endogenous2": ")" << symbol_table.getName(it->endo2) << R"(")"
+             << R"(, "lags": ")" << it->lags << R"(")"
+             << R"(, "lower_bound": ")" << it->lower_bound << R"(")"
+             << R"(, "upper_bound": ")" << it->upper_bound << R"(")"
              << "}";
     }
   output << "]"
@@ -578,23 +578,23 @@ IrfCalibration::writeOutput(ostream &output, const string &basename, bool minima
 void
 IrfCalibration::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"irf_calibration\"";
+  output << R"({"statementName": "irf_calibration")";
   if (options_list.getNumberOfOptions())
     {
       output << ", ";
       options_list.writeJsonOutput(output);
     }
 
-  output << ", \"irf_restrictions\": [";
+  output << R"(, "irf_restrictions": [)";
   for (auto it = constraints.begin(); it != constraints.end(); it++)
     {
       if (it != constraints.begin())
         output << ", ";
-      output << "{\"endogenous\": \"" << symbol_table.getName(it->endo) << "\""
-             << ", \"exogenous\": \"" << symbol_table.getName(it->exo) << "\""
-             << ", \"periods\": \"" << it->periods << "\""
-             << ", \"lower_bound\": \"" << it->lower_bound << "\""
-             << ", \"upper_bound\": \"" << it->upper_bound << "\""
+      output << R"({"endogenous": ")" << symbol_table.getName(it->endo) << R"(")"
+             << R"(, "exogenous": ")" << symbol_table.getName(it->exo) << R"(")"
+             << R"(, "periods": ")" << it->periods << R"(")"
+             << R"(, "lower_bound": ")" << it->lower_bound << R"(")"
+             << R"(, "upper_bound": ")" << it->upper_bound << R"(")"
              << "}";
     }
   output << "]"
diff --git a/src/Statement.cc b/src/Statement.cc
index 8abf256f..6e968e3f 100644
--- a/src/Statement.cc
+++ b/src/Statement.cc
@@ -55,9 +55,9 @@ void
 NativeStatement::writeOutput(ostream &output, const string &basename, bool minimal_workspace) const
 {
   using namespace boost::xpressive;
-  string date_regex = "(-?\\d+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4]\\d|5[0-2])))";
-  sregex regex_lookbehind = sregex::compile("(?<!\\$|\\d|[a-zA-Z_]|\\')" + date_regex);
-  sregex regex_dollar = sregex::compile("(\\$)"+date_regex);
+  string date_regex = R"((-?\d+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4]\d|5[0-2]))))";
+  sregex regex_lookbehind = sregex::compile(R"((?<!\$|\d|[a-zA-Z_]|\'))" + date_regex);
+  sregex regex_dollar = sregex::compile(R"((\$))"+date_regex);
 
   string ns = regex_replace(native_statement, regex_lookbehind, "dates('$&')");
   ns = regex_replace(ns, regex_dollar, "$2"); //replace $DATE with DATE
@@ -67,8 +67,8 @@ NativeStatement::writeOutput(ostream &output, const string &basename, bool minim
 void
 NativeStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"native\""
-         << ", \"string\": \"" << native_statement << "\""
+  output << R"({"statementName": "native")"
+         << R"(, "string": ")" << native_statement << R"(")"
          << "}";
 }
 
@@ -86,8 +86,8 @@ VerbatimStatement::writeOutput(ostream &output, const string &basename, bool min
 void
 VerbatimStatement::writeJsonOutput(ostream &output) const
 {
-  output << "{\"statementName\": \"verbatim\""
-         << ", \"string\": \"" << verbatim_statement << "\""
+  output << R"({"statementName": "verbatim")"
+         << R"(, "string": ")" << verbatim_statement << R"(")"
          << "}";
 }
 
@@ -204,11 +204,11 @@ OptionsList::writeJsonOutput(ostream &output) const
   if (getNumberOfOptions() == 0)
     return;
 
-  output << "\"options\": {";
+  output << R"("options": {)";
   for (auto it = num_options.begin();
        it != num_options.end();)
     {
-      output << "\""<< it->first << "\": " << it->second;
+      output << R"(")"<< it->first << R"(": )" << it->second;
       it++;
       if (it != num_options.end()
           || !(paired_num_options.empty()
@@ -222,7 +222,7 @@ OptionsList::writeJsonOutput(ostream &output) const
   for (auto it = paired_num_options.begin();
        it != paired_num_options.end();)
     {
-      output << "\""<< it->first << "\": [" << it->second.first << " " << it->second.second << "]";
+      output << R"(")"<< it->first << R"(": [)" << it->second.first << " " << it->second.second << "]";
       it++;
       if (it != paired_num_options.end()
           || !(string_options.empty()
@@ -235,7 +235,7 @@ OptionsList::writeJsonOutput(ostream &output) const
   for (auto it = string_options.begin();
        it != string_options.end();)
     {
-      output << "\""<< it->first << "\": \"" << it->second << "\"";
+      output << R"(")"<< it->first << R"(": ")" << it->second << R"(")";
       it++;
       if (it != string_options.end()
           || !(date_options.empty()
@@ -247,7 +247,7 @@ OptionsList::writeJsonOutput(ostream &output) const
   for (auto it = date_options.begin();
        it != date_options.end();)
     {
-      output << "\""<< it->first << "\": \"" << it->second << "\"";
+      output << R"(")"<< it->first << R"(": ")" << it->second << R"(")";
       it++;
       if (it != date_options.end()
           || !(symbol_list_options.empty()
@@ -258,7 +258,7 @@ OptionsList::writeJsonOutput(ostream &output) const
   for (auto it = symbol_list_options.begin();
        it != symbol_list_options.end();)
     {
-      output << "\""<< it->first << "\": {";
+      output << R"(")"<< it->first << R"(": {)";
       it->second.writeJsonOutput(output);
       output << "}";
       it++;
@@ -270,7 +270,7 @@ OptionsList::writeJsonOutput(ostream &output) const
   for (auto it = vector_int_options.begin();
        it != vector_int_options.end();)
     {
-      output << "\""<< it->first << "\": [";
+      output << R"(")"<< it->first << R"(": [)";
       if (it->second.size() > 1)
         {
           for (auto viit = it->second.begin();
@@ -293,13 +293,13 @@ OptionsList::writeJsonOutput(ostream &output) const
   for (auto it = vector_str_options.begin();
        it != vector_str_options.end();)
     {
-      output << "\""<< it->first << "\": [";
+      output << R"(")"<< it->first << R"(": [)";
       if (it->second.size() > 1)
         {
           for (auto viit = it->second.begin();
                viit != it->second.end();)
             {
-              output << "\"" << *viit << "\"";
+              output << R"(")" << *viit << R"(")";
               viit++;
               if (viit != it->second.end())
                 output << ", ";
diff --git a/src/StaticModel.cc b/src/StaticModel.cc
index ecdcb3d9..6e093cb2 100644
--- a/src/StaticModel.cc
+++ b/src/StaticModel.cc
@@ -564,7 +564,7 @@ StaticModel::writeModelEquationsCode(const string &basename, map_idx_t map_idx)
   code_file.open(main_name, ios::out | ios::binary | ios::ate);
   if (!code_file.is_open())
     {
-      cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
+      cerr << R"(Error : Can't open file ")" << main_name << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
   int count_u;
@@ -741,7 +741,7 @@ StaticModel::writeModelEquationsCode_Block(const string &basename, map_idx_t map
   code_file.open(main_name, ios::out | ios::binary | ios::ate);
   if (!code_file.is_open())
     {
-      cerr << "Error : Can't open file \"" << main_name << "\" for writing" << endl;
+      cerr << R"(Error : Can't open file ")" << main_name << R"(" for writing)" << endl;
       exit(EXIT_FAILURE);
     }
   //Temporary variables declaration
@@ -2031,7 +2031,7 @@ StaticModel::writeStaticCFile(const string &basename) const
   if (external_functions_table.get_total_number_of_unique_model_block_external_functions())
     // External Matlab function, implies Static function will call mex
     output << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-           << "#include \"mex.h\"" << endl;
+           << R"(#include "mex.h")" << endl;
 
   output << "#define max(a, b) (((a) > (b)) ? (a) : (b))" << endl
          << "#define min(a, b) (((a) > (b)) ? (b) : (a))" << endl;
@@ -2067,7 +2067,7 @@ StaticModel::writeStaticCFile(const string &basename) const
          << endl
          << "#include <stdlib.h>" << endl
          << "#include <uchar.h>" << endl // For MATLAB ≤ R2011a
-         << "#include \"mex.h\"" << endl
+         << R"(#include "mex.h")" << endl
          << endl
          << "const int ntt = " << ntt << ";" << endl
          << "void static_resid_tt(const double *y, const double *x, int nb_row_x, const double *params, double *T);" << endl
@@ -2557,9 +2557,9 @@ StaticModel::writeLatexAuxVarRecursiveDefinitions(ostream &output) const
                                                                               temporary_terms, temporary_terms_idxs, tef_terms);
   for (auto aux_equation : aux_equations)
     {
-      output << "\\begin{dmath}" << endl;
+      output << R"(\begin{dmath})" << endl;
       dynamic_cast<ExprNode *>(aux_equation->substituteStaticAuxiliaryDefinition())->writeOutput(output, ExprNodeOutputType::latexStaticModel);
-      output << endl << "\\end{dmath}" << endl;
+      output << endl << R"(\end{dmath})" << endl;
     }
 }
 
@@ -2587,11 +2587,11 @@ StaticModel::writeJsonAuxVarRecursiveDefinitions(ostream &output) const
 
   for (auto aux_equation : aux_equations)
     {
-      output << ", {\"lhs\": \"";
+      output << R"(, {"lhs": ")";
       aux_equation->arg1->writeJsonOutput(output, temporary_terms, tef_terms, false);
-      output << "\", \"rhs\": \"";
+      output << R"(", "rhs": ")";
       dynamic_cast<BinaryOpNode *>(aux_equation->substituteStaticAuxiliaryDefinition())->arg2->writeJsonOutput(output, temporary_terms, tef_terms, false);
-      output << "\"}";
+      output << R"("})";
     }
 }
 
@@ -2915,10 +2915,10 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
   temp_term_union.insert(temporary_terms_derivatives[1].begin(), temporary_terms_derivatives[1].end());
   concat = "jacobian";
   writeJsonTemporaryTerms(temp_term_union, temp_term_union_m_1, jacobian_output, tef_terms, concat);
-  jacobian_output << ", \"jacobian\": {"
-                  << "  \"nrows\": " << nrows
-                  << ", \"ncols\": " << JacobianColsNbr
-                  << ", \"entries\": [";
+  jacobian_output << R"(, "jacobian": {)"
+                  << R"(  "nrows": )" << nrows
+                  << R"(, "ncols": )" << JacobianColsNbr
+                  << R"(, "entries": [)";
   for (auto it = derivatives[1].begin();
        it != derivatives[1].end(); it++)
     {
@@ -2932,18 +2932,18 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
       expr_t d1 = it->second;
 
       if (writeDetails)
-        jacobian_output << "{\"eq\": " << eq + 1;
+        jacobian_output << R"({"eq": )" << eq + 1;
       else
-        jacobian_output << "{\"row\": " << eq + 1;
+        jacobian_output << R"({"row": )" << eq + 1;
 
-      jacobian_output << ", \"col\": " << col + 1;
+      jacobian_output << R"(, "col": )" << col + 1;
 
       if (writeDetails)
-        jacobian_output << ", \"var\": \"" << symbol_table.getName(symb_id) << "\"";
+        jacobian_output << R"(, "var": ")" << symbol_table.getName(symb_id) << R"(")";
 
-      jacobian_output << ", \"val\": \"";
+      jacobian_output << R"(, "val": ")";
       d1->writeJsonOutput(jacobian_output, temp_term_union, tef_terms);
-      jacobian_output << "\"}" << endl;
+      jacobian_output << R"("})" << endl;
     }
   jacobian_output << "]}";
 
@@ -2953,10 +2953,10 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
   temp_term_union.insert(temporary_terms_derivatives[2].begin(), temporary_terms_derivatives[2].end());
   concat = "hessian";
   writeJsonTemporaryTerms(temp_term_union, temp_term_union_m_1, hessian_output, tef_terms, concat);
-  hessian_output << ", \"hessian\": {"
-                 << "  \"nrows\": " << equations.size()
-                 << ", \"ncols\": " << g2ncols
-                 << ", \"entries\": [";
+  hessian_output << R"(, "hessian": {)"
+                 << R"(  "nrows": )" << equations.size()
+                 << R"(, "ncols": )" << g2ncols
+                 << R"(, "entries": [)";
   for (auto it = derivatives[2].begin();
        it != derivatives[2].end(); it++)
     {
@@ -2976,22 +2976,22 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
       int col_sym = tsid2*symbol_table.endo_nbr()+tsid1;
 
       if (writeDetails)
-        hessian_output << "{\"eq\": " << eq + 1;
+        hessian_output << R"({"eq": )" << eq + 1;
       else
-        hessian_output << "{\"row\": " << eq + 1;
+        hessian_output << R"({"row": )" << eq + 1;
 
-      hessian_output << ", \"col\": [" << col + 1;
+      hessian_output << R"(, "col": [)" << col + 1;
 
       if (writeDetails)
-        hessian_output << ", \"var1\": \"" << symbol_table.getName(symb_id1) << "\""
-                       << ", \"var2\": \"" << symbol_table.getName(symb_id2) << "\"";
+        hessian_output << R"(, "var1": ")" << symbol_table.getName(symb_id1) << R"(")"
+                       << R"(, "var2": ")" << symbol_table.getName(symb_id2) << R"(")";
 
       if (symb_id1 != symb_id2)
         hessian_output << ", " <<  col_sym + 1;
       hessian_output << "]"
-                     << ", \"val\": \"";
+                     << R"(, "val": ")";
       d2->writeJsonOutput(hessian_output, temp_term_union, tef_terms);
-      hessian_output << "\"}" << endl;
+      hessian_output << R"("})" << endl;
     }
   hessian_output << "]}";
 
@@ -3000,10 +3000,10 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
   temp_term_union.insert(temporary_terms_derivatives[3].begin(), temporary_terms_derivatives[3].end());
   concat = "third_derivatives";
   writeJsonTemporaryTerms(temp_term_union, temp_term_union_m_1, third_derivatives_output, tef_terms, concat);
-  third_derivatives_output << ", \"third_derivative\": {"
-                           << "  \"nrows\": " << equations.size()
-                           << ", \"ncols\": " << hessianColsNbr * JacobianColsNbr
-                           << ", \"entries\": [";
+  third_derivatives_output << R"(, "third_derivative": {)"
+                           << R"(  "nrows": )" << equations.size()
+                           << R"(, "ncols": )" << hessianColsNbr * JacobianColsNbr
+                           << R"(, "entries": [)";
   for (auto it = derivatives[3].begin();
        it != derivatives[3].end(); it++)
     {
@@ -3015,9 +3015,9 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
       expr_t d3 = it->second;
 
       if (writeDetails)
-        third_derivatives_output << "{\"eq\": " << eq + 1;
+        third_derivatives_output << R"({"eq": )" << eq + 1;
       else
-        third_derivatives_output << "{\"row\": " << eq + 1;
+        third_derivatives_output << R"({"row": )" << eq + 1;
 
       int id1 = getSymbIDByDerivID(var1);
       int id2 = getSymbIDByDerivID(var2);
@@ -3030,7 +3030,7 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
       cols.insert(id3 * hessianColsNbr + id1 * JacobianColsNbr + id2);
       cols.insert(id3 * hessianColsNbr + id2 * JacobianColsNbr + id1);
 
-      third_derivatives_output << ", \"col\": [";
+      third_derivatives_output << R"(, "col": [)";
       for (auto it2 = cols.begin(); it2 != cols.end(); it2++)
         {
           if (it2 != cols.begin())
@@ -3040,20 +3040,20 @@ StaticModel::writeJsonComputingPassOutput(ostream &output, bool writeDetails) co
       third_derivatives_output << "]";
 
       if (writeDetails)
-        third_derivatives_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
-                                 << ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
-                                 << ", \"var3\": \"" << symbol_table.getName(getSymbIDByDerivID(var3)) << "\"";
+        third_derivatives_output << R"(, "var1": ")" << symbol_table.getName(getSymbIDByDerivID(var1)) << R"(")"
+                                 << R"(, "var2": ")" << symbol_table.getName(getSymbIDByDerivID(var2)) << R"(")"
+                                 << R"(, "var3": ")" << symbol_table.getName(getSymbIDByDerivID(var3)) << R"(")";
 
-      third_derivatives_output << ", \"val\": \"";
+      third_derivatives_output << R"(, "val": ")";
       d3->writeJsonOutput(third_derivatives_output, temp_term_union, tef_terms);
-      third_derivatives_output << "\"}" << endl;
+      third_derivatives_output << R"("})" << endl;
     }
   third_derivatives_output << "]}";
 
   if (writeDetails)
-    output << "\"static_model\": {";
+    output << R"("static_model": {)";
   else
-    output << "\"static_model_simple\": {";
+    output << R"("static_model_simple": {)";
   output << model_local_vars_output.str()
          << ", " << model_output.str()
          << ", " << jacobian_output.str()
@@ -3084,10 +3084,10 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
   for (const auto &it : params_derivs_temporary_terms)
     writeJsonTemporaryTerms(it.second, temp_term_union, model_output, tef_terms, concat);
 
-  jacobian_output << "\"deriv_wrt_params\": {"
-                  << "  \"neqs\": " << equations.size()
-                  << ", \"nparamcols\": " << symbol_table.param_nbr()
-                  << ", \"entries\": [";
+  jacobian_output << R"("deriv_wrt_params": {)"
+                  << R"(  "neqs": )" << equations.size()
+                  << R"(, "nparamcols": )" << symbol_table.param_nbr()
+                  << R"(, "entries": [)";
   auto &rp = params_derivatives.find({ 0, 1 })->second;
   for (auto it = rp.begin(); it != rp.end(); it++)
     {
@@ -3101,26 +3101,26 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
 
       if (writeDetails)
-        jacobian_output << "{\"eq\": " << eq + 1;
+        jacobian_output << R"({"eq": )" << eq + 1;
       else
-        jacobian_output << "{\"row\": " << eq + 1;
+        jacobian_output << R"({"row": )" << eq + 1;
 
       if (writeDetails)
-        jacobian_output << ", \"param_col\": " << param_col;
+        jacobian_output << R"(, "param_col": )" << param_col;
 
-      jacobian_output << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
+      jacobian_output << R"(, "param": ")" << symbol_table.getName(getSymbIDByDerivID(param)) << R"(")";
 
-      jacobian_output << ", \"val\": \"";
+      jacobian_output << R"(, "val": ")";
       d1->writeJsonOutput(jacobian_output, temp_term_union, tef_terms);
-      jacobian_output << "\"}" << endl;
+      jacobian_output << R"("})" << endl;
     }
   jacobian_output << "]}";
 
-  hessian_output << "\"deriv_jacobian_wrt_params\": {"
-                 << "  \"neqs\": " << equations.size()
-                 << ", \"nvarcols\": " << symbol_table.endo_nbr()
-                 << ", \"nparamcols\": " << symbol_table.param_nbr()
-                 << ", \"entries\": [";
+  hessian_output << R"("deriv_jacobian_wrt_params": {)"
+                 << R"(  "neqs": )" << equations.size()
+                 << R"(, "nvarcols": )" << symbol_table.endo_nbr()
+                 << R"(, "nparamcols": )" << symbol_table.param_nbr()
+                 << R"(, "entries": [)";
   auto &gp = params_derivatives.find({ 1, 1 })->second;
   for (auto it = gp.begin(); it != gp.end(); it++)
     {
@@ -3135,27 +3135,27 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
 
       if (writeDetails)
-        hessian_output << "{\"eq\": " << eq + 1;
+        hessian_output << R"({"eq": )" << eq + 1;
       else
-        hessian_output << "{\"row\": " << eq + 1;
+        hessian_output << R"({"row": )" << eq + 1;
 
       if (writeDetails)
-        hessian_output << ", \"var\": \"" << symbol_table.getName(getSymbIDByDerivID(var)) << "\""
-                       << ", \"param\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
+        hessian_output << R"(, "var": ")" << symbol_table.getName(getSymbIDByDerivID(var)) << R"(")"
+                       << R"(, "param": ")" << symbol_table.getName(getSymbIDByDerivID(param)) << R"(")";
 
-      hessian_output << ", \"var_col\": " << var_col
-                     << ", \"param_col\": " << param_col
-                     << ", \"val\": \"";
+      hessian_output << R"(, "var_col": )" << var_col
+                     << R"(, "param_col": )" << param_col
+                     << R"(, "val": ")";
       d2->writeJsonOutput(hessian_output, temp_term_union, tef_terms);
-      hessian_output << "\"}" << endl;
+      hessian_output << R"("})" << endl;
     }
   hessian_output << "]}";
 
-  hessian1_output << "\"second_deriv_residuals_wrt_params\": {"
-                  << "  \"nrows\": " << equations.size()
-                  << ", \"nparam1cols\": " << symbol_table.param_nbr()
-                  << ", \"nparam2cols\": " << symbol_table.param_nbr()
-                  << ", \"entries\": [";
+  hessian1_output << R"("second_deriv_residuals_wrt_params": {)"
+                  << R"(  "nrows": )" << equations.size()
+                  << R"(, "nparam1cols": )" << symbol_table.param_nbr()
+                  << R"(, "nparam2cols": )" << symbol_table.param_nbr()
+                  << R"(, "entries": [)";
   auto &rpp = params_derivatives.find({ 0, 2 })->second;
   for (auto it = rpp.begin(); it != rpp.end(); ++it)
     {
@@ -3170,29 +3170,29 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
 
       if (writeDetails)
-        hessian1_output << "{\"eq\": " << eq + 1;
+        hessian1_output << R"({"eq": )" << eq + 1;
       else
-        hessian1_output << "{\"row\": " << eq + 1;
+        hessian1_output << R"({"row": )" << eq + 1;
 
-      hessian1_output << ", \"param1_col\": " << param1_col
-                      << ", \"param2_col\": " << param2_col;
+      hessian1_output << R"(, "param1_col": )" << param1_col
+                      << R"(, "param2_col": )" << param2_col;
 
       if (writeDetails)
-        hessian1_output << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
-                        << ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
+        hessian1_output << R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param1)) << R"(")"
+                        << R"(, "param2": ")" << symbol_table.getName(getSymbIDByDerivID(param2)) << R"(")";
 
-      hessian1_output << ", \"val\": \"";
+      hessian1_output << R"(, "val": ")";
       d2->writeJsonOutput(hessian1_output, temp_term_union, tef_terms);
-      hessian1_output << "\"}" << endl;
+      hessian1_output << R"("})" << endl;
     }
   hessian1_output << "]}";
 
-  third_derivs_output << "\"second_deriv_jacobian_wrt_params\": {"
-                      << "  \"neqs\": " << equations.size()
-                      << ", \"nvarcols\": " << symbol_table.endo_nbr()
-                      << ", \"nparam1cols\": " << symbol_table.param_nbr()
-                      << ", \"nparam2cols\": " << symbol_table.param_nbr()
-                      << ", \"entries\": [";
+  third_derivs_output << R"("second_deriv_jacobian_wrt_params": {)"
+                      << R"(  "neqs": )" << equations.size()
+                      << R"(, "nvarcols": )" << symbol_table.endo_nbr()
+                      << R"(, "nparam1cols": )" << symbol_table.param_nbr()
+                      << R"(, "nparam2cols": )" << symbol_table.param_nbr()
+                      << R"(, "entries": [)";
   auto &gpp = params_derivatives.find({ 1, 2 })->second;
   for (auto it = gpp.begin(); it != gpp.end(); ++it)
     {
@@ -3208,30 +3208,30 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param2_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param2)) + 1;
 
       if (writeDetails)
-        third_derivs_output << "{\"eq\": " << eq + 1;
+        third_derivs_output << R"({"eq": )" << eq + 1;
       else
-        third_derivs_output << "{\"row\": " << eq + 1;
-      third_derivs_output << ", \"var_col\": " << var_col
-                          << ", \"param1_col\": " << param1_col
-                          << ", \"param2_col\": " << param2_col;
+        third_derivs_output << R"({"row": )" << eq + 1;
+      third_derivs_output << R"(, "var_col": )" << var_col
+                          << R"(, "param1_col": )" << param1_col
+                          << R"(, "param2_col": )" << param2_col;
 
       if (writeDetails)
-        third_derivs_output << ", \"var\": \"" << symbol_table.getName(var) << "\""
-                            << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param1)) << "\""
-                            << ", \"param2\": \"" << symbol_table.getName(getSymbIDByDerivID(param2)) << "\"";
+        third_derivs_output << R"(, "var": ")" << symbol_table.getName(var) << R"(")"
+                            << R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param1)) << R"(")"
+                            << R"(, "param2": ")" << symbol_table.getName(getSymbIDByDerivID(param2)) << R"(")";
 
-      third_derivs_output << ", \"val\": \"";
+      third_derivs_output << R"(, "val": ")";
       d2->writeJsonOutput(third_derivs_output, temp_term_union, tef_terms);
-      third_derivs_output << "\"}" << endl;
+      third_derivs_output << R"("})" << endl;
     }
   third_derivs_output << "]}" << endl;
 
-  third_derivs1_output << "\"derivative_hessian_wrt_params\": {"
-                       << "  \"neqs\": " << equations.size()
-                       << ", \"nvar1cols\": " << symbol_table.endo_nbr()
-                       << ", \"nvar2cols\": " << symbol_table.endo_nbr()
-                       << ", \"nparamcols\": " << symbol_table.param_nbr()
-                       << ", \"entries\": [";
+  third_derivs1_output << R"("derivative_hessian_wrt_params": {)"
+                       << R"(  "neqs": )" << equations.size()
+                       << R"(, "nvar1cols": )" << symbol_table.endo_nbr()
+                       << R"(, "nvar2cols": )" << symbol_table.endo_nbr()
+                       << R"(, "nparamcols": )" << symbol_table.param_nbr()
+                       << R"(, "entries": [)";
   auto &hp = params_derivatives.find({ 2, 1 })->second;
   for (auto it = hp.begin(); it != hp.end(); ++it)
     {
@@ -3247,29 +3247,29 @@ StaticModel::writeJsonParamsDerivativesFile(ostream &output, bool writeDetails)
       int param_col = symbol_table.getTypeSpecificID(getSymbIDByDerivID(param)) + 1;
 
       if (writeDetails)
-        third_derivs1_output << "{\"eq\": " << eq + 1;
+        third_derivs1_output << R"({"eq": )" << eq + 1;
       else
-        third_derivs1_output << "{\"row\": " << eq + 1;
+        third_derivs1_output << R"({"row": )" << eq + 1;
 
-      third_derivs1_output << ", \"var1_col\": " << var1_col
-                           << ", \"var2_col\": " << var2_col
-                           << ", \"param_col\": " << param_col;
+      third_derivs1_output << R"(, "var1_col": )" << var1_col
+                           << R"(, "var2_col": )" << var2_col
+                           << R"(, "param_col": )" << param_col;
 
       if (writeDetails)
-        third_derivs1_output << ", \"var1\": \"" << symbol_table.getName(getSymbIDByDerivID(var1)) << "\""
-                             << ", \"var2\": \"" << symbol_table.getName(getSymbIDByDerivID(var2)) << "\""
-                             << ", \"param1\": \"" << symbol_table.getName(getSymbIDByDerivID(param)) << "\"";
+        third_derivs1_output << R"(, "var1": ")" << symbol_table.getName(getSymbIDByDerivID(var1)) << R"(")"
+                             << R"(, "var2": ")" << symbol_table.getName(getSymbIDByDerivID(var2)) << R"(")"
+                             << R"(, "param1": ")" << symbol_table.getName(getSymbIDByDerivID(param)) << R"(")";
 
-      third_derivs1_output << ", \"val\": \"";
+      third_derivs1_output << R"(, "val": ")";
       d2->writeJsonOutput(third_derivs1_output, temp_term_union, tef_terms);
-      third_derivs1_output << "\"}" << endl;
+      third_derivs1_output << R"("})" << endl;
     }
   third_derivs1_output << "]}" << endl;
 
   if (writeDetails)
-    output << "\"static_model_params_derivative\": {";
+    output << R"("static_model_params_derivative": {)";
   else
-    output << "\"static_model_params_derivatives_simple\": {";
+    output << R"("static_model_params_derivatives_simple": {)";
   output << model_local_vars_output.str()
          << ", " << model_output.str()
          << ", " << jacobian_output.str()
diff --git a/src/SubModel.cc b/src/SubModel.cc
index 4fd8a1db..17198ebf 100644
--- a/src/SubModel.cc
+++ b/src/SubModel.cc
@@ -407,19 +407,19 @@ TrendComponentModelTable::writeJsonOutput(ostream &output) const
     {
       if (name != *(names.begin()))
         output << ", ";
-      output << "{\"statementName\": \"trend_component_model\","
-             << "\"model_name\": \"" << name << "\","
-             << "\"eqtags\": [";
+      output << R"({"statementName": "trend_component_model",)"
+             << R"("model_name": ")" << name << R"(",)"
+             << R"("eqtags": [)";
       for (const auto &it : eqtags.at(name))
         {
-          output << "\"" << it << "\"";
+          output << R"(")" << it << R"(")";
           if (&it != &eqtags.at(name).back())
             output << ", ";
         }
-      output << "], \"target_eqtags\": [";
+      output << R"(], "target_eqtags": [)";
       for (const auto &it : target_eqtags.at(name))
         {
-          output << "\"" << it << "\"";
+          output << R"(")" << it << R"(")";
           if (&it != &target_eqtags.at(name).back())
             output << ", ";
         }
@@ -547,21 +547,21 @@ VarModelTable::writeJsonOutput(ostream &output) const
     {
       if (name != *(names.begin()))
         output << ", ";
-      output << "{\"statementName\": \"var_model\","
-             << "\"model_name\": \"" << name << "\",";
+      output << R"({"statementName": "var_model",)"
+             << R"("model_name": ")" << name << R"(",)";
       if (symbol_list_and_order.empty())
         {
-          output << "\"eqtags\": [";
+          output << R"("eqtags": [)";
           for (const auto &it : eqtags.at(name))
             {
-              output << "\"" << it << "\"";
+              output << R"(")" << it << R"(")";
               if (&it != &eqtags.at(name).back())
                 output << ", ";
             }
           output << "]";
         }
       else
-        output << "\"order\": \"" << symbol_list_and_order.at(name).second << "\"";
+        output << R"("order": ")" << symbol_list_and_order.at(name).second << R"(")";
       output << "}";
     }
 }
diff --git a/src/SymbolList.cc b/src/SymbolList.cc
index 0eeec423..4f11bb9f 100644
--- a/src/SymbolList.cc
+++ b/src/SymbolList.cc
@@ -42,13 +42,13 @@ SymbolList::writeOutput(const string &varname, ostream &output) const
 void
 SymbolList::writeJsonOutput(ostream &output) const
 {
-  output << "\"symbol_list\": [";
+  output << R"("symbol_list": [)";
   for (auto it = symbols.begin();
        it != symbols.end(); ++it)
     {
       if (it != symbols.begin())
         output << ",";
-      output << "\"" << *it << "\"";
+      output << R"(")" << *it << R"(")";
     }
   output << "]";
 }
diff --git a/src/SymbolTable.cc b/src/SymbolTable.cc
index 912cbc70..a615c9af 100644
--- a/src/SymbolTable.cc
+++ b/src/SymbolTable.cc
@@ -64,7 +64,7 @@ SymbolTable::addSymbol(const string &name, SymbolType type, const string &tex_na
       size_t pos = 0;
       while ((pos = final_tex_name.find('_', pos)) != string::npos)
         {
-          final_tex_name.insert(pos, "\\");
+          final_tex_name.insert(pos, R"(\)");
           pos += 2;
         }
     }
@@ -375,7 +375,7 @@ SymbolTable::writeOutput(ostream &output) const noexcept(false)
             output << "M_.aux_vars(" << i+1 << ").orig_index = " << getTypeSpecificID(aux_vars[i].get_orig_symb_id())+1 << ";" << endl;
             break;
           case AuxVarType::expectation:
-            output << "M_.aux_vars(" << i+1 << ").orig_expr = '\\mathbb{E}_{t"
+            output << "M_.aux_vars(" << i+1 << R"().orig_expr = '\mathbb{E}_{t)"
                    << (aux_vars[i].get_information_set() < 0 ? "" : "+")
                    << aux_vars[i].get_information_set() << "}(";
             aux_vars[i].get_expr_node()->writeOutput(output, ExprNodeOutputType::latexDynamicModel);
@@ -440,7 +440,7 @@ SymbolTable::writeCOutput(ostream &output) const noexcept(false)
     {
       output << "char *exo_names[" << exo_nbr() << "];" << endl;
       for (int id = 0; id < exo_nbr(); id++)
-        output << "exo_names[" << id << "] = \"" << getName(exo_ids[id]) << "\";" << endl;
+        output << "exo_names[" << id << R"(] = ")" << getName(exo_ids[id]) << R"(";)" << endl;
     }
 
   output << endl
@@ -449,7 +449,7 @@ SymbolTable::writeCOutput(ostream &output) const noexcept(false)
     {
       output << "char *exo_det_names[" << exo_det_nbr() << "];" << endl;
       for (int id = 0; id < exo_det_nbr(); id++)
-        output << "exo_det_names[" << id << "] = \"" << getName(exo_det_ids[id]) << "\";" << endl;
+        output << "exo_det_names[" << id << R"(] = ")" << getName(exo_det_ids[id]) << R"(";)" << endl;
     }
 
   output << endl
@@ -458,7 +458,7 @@ SymbolTable::writeCOutput(ostream &output) const noexcept(false)
     {
       output << "char *endo_names[" << endo_nbr() << "];" << endl;
       for (int id = 0; id < endo_nbr(); id++)
-        output << "endo_names[" << id << "] = \"" << getName(endo_ids[id]) << "\";" << endl;
+        output << "endo_names[" << id << R"(] = ")" << getName(endo_ids[id]) << R"(";)" << endl;
     }
 
   output << endl
@@ -467,7 +467,7 @@ SymbolTable::writeCOutput(ostream &output) const noexcept(false)
     {
       output << "char *param_names[" << param_nbr() << "];" << endl;
       for (int id = 0; id < param_nbr(); id++)
-        output << "param_names[" << id << "] = \"" << getName(param_ids[id]) << "\";" << endl;
+        output << "param_names[" << id << R"(] = ")" << getName(param_ids[id]) << R"(";)" << endl;
     }
 
   // Write the auxiliary variable table
@@ -497,7 +497,7 @@ SymbolTable::writeCOutput(ostream &output) const noexcept(false)
               if (aux_vars[i].get_orig_symb_id() >= 0)
                 output << "av[" << i << "].orig_index = " << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) << ";" << endl
                        << "av[" << i << "].orig_lead_lag = " << aux_vars[i].get_orig_lead_lag() << ";" << endl;
-              output << "av[" << i << "].unary_op = \"" << aux_vars[i].get_unary_op() << "\";" << endl;
+              output << "av[" << i << R"(].unary_op = ")" << aux_vars[i].get_unary_op() << R"(";)" << endl;
               break;
             case AuxVarType::diff:
             case AuxVarType::diffLag:
@@ -562,22 +562,22 @@ SymbolTable::writeCCOutput(ostream &output) const noexcept(false)
   output << endl
          << "exo_nbr = " << exo_nbr() << ";" << endl;
   for (int id = 0; id < exo_nbr(); id++)
-    output << "exo_names[\"" << getName(exo_ids[id]) << "\"] = " << id << ";" << endl;
+    output << R"(exo_names[")" << getName(exo_ids[id]) << R"("] = )" << id << ";" << endl;
 
   output << endl
          << "exo_det_nbr = " << exo_det_nbr() << ";" << endl;
   for (int id = 0; id < exo_det_nbr(); id++)
-    output << "exo_det_names[\"" << getName(exo_det_ids[id]) << "\"] = " << id << " ;" << endl;
+    output << R"(exo_det_names[")" << getName(exo_det_ids[id]) << R"("] = )" << id << " ;" << endl;
 
   output << endl
          << "endo_nbr = " << endo_nbr() << ";" << endl;
   for (int id = 0; id < endo_nbr(); id++)
-    output << "endo_names[\"" << getName(endo_ids[id]) << "\"] = " << id << ";" << endl;
+    output << R"(endo_names[")" << getName(endo_ids[id]) << R"("] = )" << id << ";" << endl;
 
   output << endl
          << "param_nbr = " << param_nbr() << ";" << endl;
   for (int id = 0; id < param_nbr(); id++)
-    output << "param_names[\"" << getName(param_ids[id]) << "\"] = " << id << ";" << endl;
+    output << R"(param_names[")" << getName(param_ids[id]) << R"("] = )" << id << ";" << endl;
 
   // Write the auxiliary variable table
   for (int i = 0; i < (int) aux_vars.size(); i++)
@@ -603,7 +603,7 @@ SymbolTable::writeCCOutput(ostream &output) const noexcept(false)
           if (aux_vars[i].get_orig_symb_id() >= 0)
             output << "av" << i << ".orig_index = " << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) << ";" << endl
                    << "av" << i << ".orig_lead_lag = " << aux_vars[i].get_orig_lead_lag() << ";" << endl;
-          output << "av" << i << ".unary_op = \"" << aux_vars[i].get_unary_op() << "\";" << endl;
+          output << "av" << i << R"(.unary_op = ")" << aux_vars[i].get_unary_op() << R"(";)" << endl;
           break;
         case AuxVarType::diff:
         case AuxVarType::diffLag:
@@ -1123,10 +1123,10 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
          << "model_.endo = [" << endl;
   if (endo_nbr() > 0)
     for (int id = 0; id < endo_nbr(); id++)
-      output << "              DynareModel.Endo(\""
-             << getName(endo_ids[id]) << "\", raw\""
-             << getTeXName(endo_ids[id]) << "\", \""
-             << getLongName(endo_ids[id]) << "\")" << endl;
+      output << R"(              DynareModel.Endo(")"
+             << getName(endo_ids[id]) << R"(", raw")"
+             << getTeXName(endo_ids[id]) << R"(", ")"
+             << getLongName(endo_ids[id]) << R"("))" << endl;
   output << "             ]" << endl;
   output << "model_.endo_nbr = " << endo_nbr() << ";" << endl;
 
@@ -1134,10 +1134,10 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
          << "model_.exo = [" << endl;
   if (exo_nbr() > 0)
     for (int id = 0; id < exo_nbr(); id++)
-      output << "             DynareModel.Exo(\""
-             << getName(exo_ids[id]) << "\", raw\""
-             << getTeXName(exo_ids[id]) << "\", \""
-             << getLongName(exo_ids[id]) << "\")" << endl;
+      output << R"(             DynareModel.Exo(")"
+             << getName(exo_ids[id]) << R"(", raw")"
+             << getTeXName(exo_ids[id]) << R"(", ")"
+             << getLongName(exo_ids[id]) << R"("))" << endl;
   output << "            ]" << endl;
   output << "model_.exo_nbr = " << exo_nbr() << ";" << endl;
 
@@ -1147,10 +1147,10 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
              << "model_.exo_det = [" << endl;
       if (exo_det_nbr() > 0)
         for (int id = 0; id < exo_det_nbr(); id++)
-          output << "                 DynareModel.ExoDet(\""
-                 << getName(exo_det_ids[id]) << "\", raw\""
-                 << getTeXName(exo_det_ids[id]) << "\", \""
-                 << getLongName(exo_det_ids[id]) << "\")" << endl;
+          output << R"(                 DynareModel.ExoDet(")"
+                 << getName(exo_det_ids[id]) << R"(", raw")"
+                 << getTeXName(exo_det_ids[id]) << R"(", ")"
+                 << getLongName(exo_det_ids[id]) << R"("))" << endl;
       output << "                ]" << endl;
       output << "model_.exo_det_nbr = " << exo_det_nbr() << ";" << endl;
     }
@@ -1159,10 +1159,10 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
          << "model_.param = [" << endl;
   if (param_nbr() > 0)
     for (int id = 0; id < param_nbr(); id++)
-      output << "               DynareModel.Param(\""
-             << getName(param_ids[id]) << "\", raw\""
-             << getTeXName(param_ids[id]) << "\", \""
-             << getLongName(param_ids[id]) << "\")" << endl;
+      output << R"(               DynareModel.Param(")"
+             << getName(param_ids[id]) << R"(", raw")"
+             << getTeXName(param_ids[id]) << R"(", ")"
+             << getLongName(param_ids[id]) << R"("))" << endl;
   output << "              ]" << endl;
   output << "model_.param_nbr = " << param_nbr() << ";" << endl;
 
@@ -1193,7 +1193,7 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
               else
                 output << "typemin(Int), typemin(Int)";
               output << ", typemin(Int), string(), "
-                     << "\"" << aux_var.get_unary_op() << "\"" << endl;
+                     << R"(")" << aux_var.get_unary_op() << R"(")" << endl;
               break;
             case AuxVarType::diff:
             case AuxVarType::diffLag:
@@ -1210,11 +1210,11 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
               output << getTypeSpecificID(aux_var.get_orig_symb_id())+1 << ", typemin(Int), typemin(Int), string(), string()";
               break;
             case AuxVarType::expectation:
-              output << "typemin(Int), typemin(Int), typemin(Int), \"\\mathbb{E}_{t"
+              output << R"(typemin(Int), typemin(Int), typemin(Int), "\mathbb{E}_{t)"
                      << (aux_var.get_information_set() < 0 ? "" : "+")
                      << aux_var.get_information_set() << "}(";
               aux_var.get_expr_node()->writeOutput(output, ExprNodeOutputType::latexDynamicModel);
-              output << ")\"";
+              output << R"lit()")lit";
               break;
             default:
               output << " typemin(Int), typemin(Int), typemin(Int), string(), string()";
@@ -1248,16 +1248,16 @@ SymbolTable::writeJuliaOutput(ostream &output) const noexcept(false)
 void
 SymbolTable::writeJsonOutput(ostream &output) const
 {
-  output << "\"endogenous\": ";
+  output << R"("endogenous": )";
   writeJsonVarVector(output, endo_ids);
 
-  output << ", \"exogenous\":";
+  output << R"(, "exogenous":)";
   writeJsonVarVector(output, exo_ids);
 
-  output << ", \"exogenous_deterministic\": ";
+  output << R"(, "exogenous_deterministic": )";
   writeJsonVarVector(output, exo_det_ids);
 
-  output << ", \"parameters\": ";
+  output << R"(, "parameters": )";
   writeJsonVarVector(output, param_ids);
 }
 
@@ -1270,9 +1270,9 @@ SymbolTable::writeJsonVarVector(ostream &output, const vector<int> &varvec) cons
       if (i != 0)
         output << ", ";
       output << "{"
-             << "\"name\":\"" << getName(varvec[i]) << "\", "
-             << "\"texName\":\"" << boost::replace_all_copy(getTeXName(varvec[i]), "\\", "\\\\") << "\", "
-             << "\"longName\":\"" << boost::replace_all_copy(getLongName(varvec[i]), "\\", "\\\\") << "\"}"
+             << R"("name":")" << getName(varvec[i]) << R"(", )"
+             << R"("texName":")" << boost::replace_all_copy(getTeXName(varvec[i]), R"(\)", R"(\\)") << R"(", )"
+             << R"("longName":")" << boost::replace_all_copy(getLongName(varvec[i]), R"(\)", R"(\\)") << R"("})"
              << endl;
     }
   output << "]" << endl;
diff --git a/src/macro/MacroDriver.cc b/src/macro/MacroDriver.cc
index 5b341fd2..ef4e45be 100644
--- a/src/macro/MacroDriver.cc
+++ b/src/macro/MacroDriver.cc
@@ -53,7 +53,7 @@ MacroDriver::parse(const string &file_arg, const string &basename_arg, istream &
           // If the input is an array. Issue #1578
           file_with_endl << "@#define " << define.first << " = " << define.second << endl;
         else
-          file_with_endl << "@#define " << define.first << " = \"" << define.second << "\"" << endl;
+          file_with_endl << "@#define " << define.first << R"( = ")" << define.second << R"(")" << endl;
       }
   file_with_endl << modfile.rdbuf() << endl;
 
@@ -65,7 +65,7 @@ MacroDriver::parse(const string &file_arg, const string &basename_arg, istream &
 
   // Output first @#line statement
   if (!no_line_macro)
-    out << "@#line \"" << file << "\" 1" << endl;
+    out << R"(@#line ")" << file << R"(" 1)" << endl;
 
   // Launch macro-processing
   parser.parse();
@@ -88,7 +88,7 @@ MacroDriver::replace_vars_in_str(const string &s) const
   smatch name;
   string name_str ("[A-Za-z_][A-Za-z0-9_]*");
   regex name_regex (name_str);                               // Matches NAME
-  regex macro_regex ("@\\s*\\{\\s*" + name_str + "\\s*\\}"); // Matches @{NAME} with potential whitespace
+  regex macro_regex (R"(@\s*\{\s*)" + name_str + R"(\s*\})"); // Matches @{NAME} with potential whitespace
   for(sregex_iterator it = sregex_iterator(s.begin(), s.end(), macro_regex);
       it != std::sregex_iterator(); ++it)
     {
@@ -412,7 +412,7 @@ MacroDriver::printvars(const Macro::parser::location_type &l, const bool tostdou
 
   stringstream intomfile;
   if (!no_line_macro)
-    intomfile << "@#line \"" << file << "\" " << l.begin.line << endl;
+    intomfile << R"(@#line ")" << file << R"(" )" << l.begin.line << endl;
 
   for (const auto & it : env)
     intomfile<< "options_.macrovars_line_" << l.begin.line << "." << it.first << " = " << it.second->print() << ";" << endl;
-- 
GitLab