diff --git a/plugins/exporter.koplugin/target/json.lua b/plugins/exporter.koplugin/target/json.lua index 0a5d59b77..4774e4a4f 100644 --- a/plugins/exporter.koplugin/target/json.lua +++ b/plugins/exporter.koplugin/target/json.lua @@ -1,5 +1,6 @@ -local json = require("json") local Device = require("device") +local rapidjson = require("rapidjson") + -- json exporter local JsonExporter = require("base"):new { name = "json", @@ -41,7 +42,7 @@ function JsonExporter:export(t) end local file = io.open(path, "w") if not file then return false end - file:write(json.encode(exportable)) + file:write(rapidjson.encode(exportable, {pretty = true})) file:write("\n") file:close() return true @@ -51,7 +52,7 @@ function JsonExporter:share(t) local content = format(t) content.created_on = self.timestamp or os.time() content.version = self:getVersion() - Device:doShareText(content) + Device:doShareText(rapidjson.encode(content, {pretty = true})) end return JsonExporter