From e44ed0d9811b0c53b3288c54d15e2f68b8d650ed Mon Sep 17 00:00:00 2001
From: ulrich
Date: Fri, 09 Apr 2021 14:09:45 +0000
Subject: [PATCH] Entitaetslisten vereinheitlicht

---
 src/de/uhilger/mediaz/api/JsonHelper.java |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/de/uhilger/mediaz/api/JsonHelper.java b/src/de/uhilger/mediaz/api/JsonHelper.java
index 1c91930..b84c51e 100644
--- a/src/de/uhilger/mediaz/api/JsonHelper.java
+++ b/src/de/uhilger/mediaz/api/JsonHelper.java
@@ -28,6 +28,7 @@
   }
   
   public String jsonWithCustomType(Object o, String typeName) {
+    /*
     StringBuilder sb = new StringBuilder();
     sb.append("{\"");
     sb.append(typeName);
@@ -36,6 +37,21 @@
     sb.append(gson.toJson(o));
     sb.append("}");
     return sb.toString();
+    */
+    Gson gson = new Gson();
+    return embedInCustomType(gson.toJson(o), typeName);
+  }
+  
+  public String embedInCustomType(String jsonStr, String typeName) {
+    StringBuilder sb = new StringBuilder();
+    sb.append("{\"");
+    sb.append(typeName);
+    sb.append("\": ");
+    //Gson gson = new Gson();
+    //sb.append(gson.toJson(o));
+    sb.append(jsonStr);
+    sb.append("}");
+    return sb.toString();
   }
   
 }

--
Gitblit v1.9.3