From a5eac0260a8735761002f920fc0622755a33a834 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Wed, 14 Dec 2022 12:15:13 +0100
Subject: [PATCH] JSON: fix output of date options

They were not enclosed within quotes.

Ref. dynare#1875
---
 src/Statement.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Statement.cc b/src/Statement.cc
index 10e94dcb..b4c357f4 100644
--- a/src/Statement.cc
+++ b/src/Statement.cc
@@ -278,11 +278,11 @@ OptionsList::writeJsonOutput(ostream &output) const
       output << R"(")" << name << R"(": )";
       std::visit([&]<class T>(const T &v)
       {
-        if constexpr(is_same_v<T, NumVal> || is_same_v<T, DateVal>)
+        if constexpr(is_same_v<T, NumVal>)
           output << v;
         else if constexpr(is_same_v<T, pair<string, string>>)
           output << '[' << v.first << ", " << v.second << ']';
-        else if constexpr(is_same_v<T, StringVal>)
+        else if constexpr(is_same_v<T, StringVal> || is_same_v<T, DateVal>)
           output << '"' << v << '"';
         else if constexpr(is_same_v<T, SymbolListVal>)
           {
-- 
GitLab