local xml = require("LuaXml") local cjson = require "cjson" local path = ngx.var.request:split(" ")[2] local m = ngx.re.match(path,[=[/([^/]+)\.json]=]) local res = ngx.location.capture("/v1/word/".. m[1] .. ".xml") local my_xml = xml.eval(res.body) local sent_val = my_xml:find("sentiment")[1] local word_val = my_xml:find("word")[1] local t = {sentiment = sent_val, word = word_val} local value=cjson.encode(t) ngx.say(value)