From fcc734a744409e307d334a1f8f4bfcfc0a319cb1 Mon Sep 17 00:00:00 2001 From: ulrich Date: Thu, 08 Apr 2021 19:41:43 +0000 Subject: [PATCH] Titel auf Abspielliste, Abspielliste anzeigen, Eintrag auswaehlen --- 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