diff --git a/src/main/java/voruti/json2config/model/json/JsonChannelLink.java b/src/main/java/voruti/json2config/model/json/JsonChannelLink.java index e63a5fb..79c40ce 100644 --- a/src/main/java/voruti/json2config/model/json/JsonChannelLink.java +++ b/src/main/java/voruti/json2config/model/json/JsonChannelLink.java @@ -14,7 +14,15 @@ public class JsonChannelLink implements IConvertible { @Override public String toConfigLine(String lineBefore) { - return String.format("%s {channel=\"%s\"}", lineBefore, String.join(":", value.channelUID.segments)).strip(); + String format = "channel=\"%s\"}"; + if (lineBefore.endsWith("}")) { + lineBefore = lineBefore.substring(0, lineBefore.length() - 1); + format = "%s, " + format; + } else { + format = "%s {" + format; + } + + return String.format(format, lineBefore, String.join(":", value.channelUID.segments)).strip(); }