]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix JSON export of templates
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 21 Aug 2021 20:15:52 +0000 (23:15 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sat, 21 Aug 2021 20:15:52 +0000 (23:15 +0300)
app/src/main/java/net/ktnx/mobileledger/async/ConfigWriter.java

index 3db7ecd6998b1fc78d691cd6bb34a008dffd0332..f72a2913f05d3b7cb5cac97f3c22b1ab9284bf21 100644 (file)
@@ -105,6 +105,8 @@ public class ConfigWriter extends ConfigIO {
         w.name("templates")
          .beginArray();
         for (TemplateWithAccounts t : templates) {
+            w.beginObject();
+
             w.name(Keys.UUID)
              .value(t.header.getUuid());
             w.name(Keys.NAME)
@@ -128,6 +130,8 @@ public class ConfigWriter extends ConfigIO {
                 w.name(Keys.ACCOUNTS)
                  .beginArray();
                 for (TemplateAccount a : t.accounts) {
+                    w.beginObject();
+
                     writeKey(w, Keys.NAME, a.getAccountName());
                     writeKey(w, Keys.NAME_GROUP, a.getAccountNameMatchGroup());
                     writeKey(w, Keys.COMMENT, a.getAccountComment());
@@ -137,9 +141,13 @@ public class ConfigWriter extends ConfigIO {
                     writeKey(w, Keys.NEGATE_AMOUNT, a.getNegateAmount());
                     writeKey(w, Keys.CURRENCY, a.getCurrency());
                     writeKey(w, Keys.CURRENCY_GROUP, a.getCurrencyMatchGroup());
+
+                    w.endObject();
                 }
                 w.endArray();
             }
+
+            w.endObject();
         }
         w.endArray();
     }