From d5d2e81ebbb7cacd2c536eb525ec0001a38f6056 Mon Sep 17 00:00:00 2001 From: Artemy Date: Sun, 14 Aug 2022 23:33:49 +0300 Subject: [PATCH] feat: toString method --- src/interpreter.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/interpreter.rs b/src/interpreter.rs index ba69510..271312c 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -191,6 +191,13 @@ impl Interpreter { self.error("Unsupported data type for the `arr` argument, must be an array"); } }, + "toString" => { + return serde_json::Value::String( + serde_json::to_string_pretty(&self.eval_node(value)) + .expect("Some error"), + ) + } + "obj" => match value { Value::Object(value) => { return self.calc_obj(value);