diff --git a/include/inja/renderer.hpp b/include/inja/renderer.hpp index 5427c3d..1c0d97e 100644 --- a/include/inja/renderer.hpp +++ b/include/inja/renderer.hpp @@ -344,7 +344,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 b1119db..46bdb65 100644 --- a/single_include/inja/inja.hpp +++ b/single_include/inja/inja.hpp @@ -3600,7 +3600,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;