Skip to content

Commit

Permalink
a small tweak to the json
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Nov 30, 2023
1 parent e77a713 commit fd1c631
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,16 @@ class ContentJson(
else -> {
val json = JsonObject()
encodedContent?.let {
val gson = GsonBuilder().create()
val encodedType = gson.toJson(encodedContent.type)
val parameters = gson.toJson(encodedContent.parametersMap)

val typeJson = JsonObject()
typeJson.addProperty("authorityId", encodedContent.type.authorityId)
typeJson.addProperty("typeId", encodedContent.type.typeId)
typeJson.addProperty("versionMajor", encodedContent.type.versionMajor)
typeJson.addProperty("versionMinor", encodedContent.type.versionMinor)
val parameters = GsonBuilder().create().toJson(encodedContent.parametersMap)

json.addProperty("fallback", encodedContent.fallback)
json.add("parameters", JsonParser.parseString(parameters))
json.add("type", JsonParser.parseString(encodedType))
json.add("type", typeJson)
}
val encodedContentJSON = json.toString()
if (encodedContentJSON.isNotBlank()) {
Expand Down

0 comments on commit fd1c631

Please sign in to comment.