diff --git a/include/inja/renderer.hpp b/include/inja/renderer.hpp index 9a4dae0..603c45d 100644 --- a/include/inja/renderer.hpp +++ b/include/inja/renderer.hpp @@ -334,7 +334,7 @@ class Renderer : public NodeVisitor { } break; case Op::Exists: { auto &&name = get_arguments<1>(node)[0]->get_ref(); - result_ptr = std::make_shared(json_input->find(name) != json_input->end()); + result_ptr = std::make_shared(json_input->contains(json::json_pointer(JsonNode(name, 0).ptr))); json_tmp_stack.push_back(result_ptr); json_eval_stack.push(result_ptr.get()); } break; diff --git a/single_include/inja/inja.hpp b/single_include/inja/inja.hpp index 755827b..39f5a59 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -3576,7 +3576,7 @@ class Renderer : public NodeVisitor { } break; case Op::Exists: { auto &&name = get_arguments<1>(node)[0]->get_ref(); - result_ptr = std::make_shared(json_input->find(name) != json_input->end()); + result_ptr = std::make_shared(json_input->contains(json::json_pointer(JsonNode(name, 0).ptr))); json_tmp_stack.push_back(result_ptr); json_eval_stack.push(result_ptr.get()); } break;