diff mod_rest/jsonmap.lib.lua @ 4731:d71beacaec3b

mod_rest: Apply JSON mapping to items in <xmpp> container (e.g. MAM results etc)
author Kim Alvefur <zash@zash.se>
date Wed, 27 Oct 2021 20:43:17 +0200
parents b68b801ddc50
children 607cac9b9393
line wrap: on
line diff
--- a/mod_rest/jsonmap.lib.lua	Wed Oct 27 19:12:03 2021 +0100
+++ b/mod_rest/jsonmap.lib.lua	Wed Oct 27 20:43:17 2021 +0200
@@ -406,6 +406,13 @@
 }
 
 local function st2json(s)
+	if s.name == "xmpp" then
+		local result = array();
+		for child in s:childtags() do
+			result:push(st2json(child));
+		end
+		return { xmpp = result };
+	end
 	local t = map.parse(schema.properties[s.name], s);
 
 	t.kind = s.name;