diff --git a/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/PathMatcher.java b/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/PathMatcher.java index ef8024a1..9d7e1e41 100644 --- a/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/PathMatcher.java +++ b/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/PathMatcher.java @@ -57,8 +57,8 @@ private static class SimplePathMatcher extends PathMatcher { @Override boolean matches(String pathToMatch) { return path.equals(pathToMatch) - || ((path.startsWith("$.") || path.startsWith("$[")) - && path.substring(2).equals(pathToMatch)); + || (path.startsWith("$.") && path.substring(2).equals(pathToMatch)) + || (path.startsWith("$[") && path.substring(1).equals(pathToMatch)); } }