summaryrefslogtreecommitdiffstats
path: root/src/yaml-extension-functions.cc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yaml-extension-functions.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/yaml-extension-functions.cc b/src/yaml-extension-functions.cc
index 0a58652..e19af49 100644
--- a/src/yaml-extension-functions.cc
+++ b/src/yaml-extension-functions.cc
@@ -36,7 +36,7 @@
#include "ryml_all.hpp"
#include "sqlite-extension-func.hh"
#include "vtab_module.hh"
-#include "yajlpp/yajlpp.hh"
+#include "vtab_module_json.hh"
using namespace lnav::roles::literals;
@@ -57,7 +57,7 @@ ryml_error_to_um(const char* msg, size_t len, ryml::Location loc, void* ud)
source_location{src, (int32_t) loc.line}, ""));
}
-static text_auto_buffer
+static json_string
yaml_to_json(string_fragment in)
{
ryml::Callbacks callbacks(&in, nullptr, nullptr, ryml_error_to_um);
@@ -75,7 +75,7 @@ yaml_to_json(string_fragment in)
ryml::substr(buf.in(), buf.size()),
/*error_on_excess*/ true);
- return {std::move(buf)};
+ return json_string{std::move(buf)};
}
int
@@ -87,6 +87,7 @@ yaml_extension_functions(struct FuncDef** basic_funcs,
help_text("yaml_to_json",
"Convert a YAML document to a JSON-encoded string")
.sql_function()
+ .with_prql_path({"yaml", "to_json"})
.with_parameter({"yaml", "The YAML value to convert to JSON."})
.with_tags({"json", "yaml"})
.with_example({