From 3298c335e6938994f0e1e17fe132e7cadc66040a Mon Sep 17 00:00:00 2001 From: Mike Nolan Date: Tue, 8 Apr 2025 23:03:56 -0500 Subject: [PATCH] JSON fixed serialization to have space after comma --- src/Serialization/Json.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Serialization/Json.cpp b/src/Serialization/Json.cpp index 7b01f2c..1b064bf 100644 --- a/src/Serialization/Json.cpp +++ b/src/Serialization/Json.cpp @@ -480,15 +480,17 @@ namespace Tesses::Framework::Serialization::Json bool first=true; for(auto item : dict) { - if(!first) { - str.push_back(','); - } + if(indent) { + if(first) str.push_back(','); str.append("\n"); str.append(tab(Encode(item.first,true) + ": " + Encode(item.second,true))); } else { + if(!first) { + str.append(", "); + } str.append(Encode(item.first,false)+": "+Encode(item.second,false)); } first=false; @@ -504,16 +506,18 @@ namespace Tesses::Framework::Serialization::Json for(auto item : ls) { - if(!first) { - str.push_back(','); - } if(indent) { + + if(!first) { + str.push_back(','); + } str.append("\n"); str.append(tab(Encode(item,true))); } else { - str.append(Encode(item,false)); + if(!first) str.append(", "); + str.append(Encode(item,false)); } first=false; }