### Question:
JSNode implements Map<String, Object> { static String fromJsonPath(String jsonPath) { if (jsonPath.charAt(0) == '$') jsonPath = jsonPath.substring(1); jsonPath = jsonPath.replace("@.", "@_"); jsonPath = jsonPath.replaceAll("([a-zA-Z])\\[", "$1.["); jsonPath = jsonPath.replace("..", "**."); jsonPath = jsonPath.replaceAll("([a-zA-Z])[*]", "$1.*"); jsonPath = jsonPath.replaceAll("([a-zA-Z])\\[([0-9]*)\\]", "$1.$2"); jsonPath = jsonPath.replaceAll("\\.\\[([0-9]*)\\]", ".$1"); jsonPath = jsonPath.replace("[*]", "*"); return jsonPath; } JSNode();  JSNode(Object... nameValuePairs);  JSNode(Map nameValuePairs); static Object parseJson(String json); static JSNode parseJsonNode(String json); static JSArray parseJsonArray(String json); JSArray findAll(String pathExpression, int qty); JSArray diff(JSNode source); void patch(JSArray patches); @Override Object get(Object name); JSNode getNode(String name); JSArray getArray(String name); String getString(String name); int getInt(String name); double getDouble(String name); boolean getBoolean(String name); JSNode findNode(String pathExpression); JSArray findArray(String pathExpression); String findString(String pathExpression); int findInt(String pathExpression); double findDouble(String pathExpression); boolean findBoolean(String pathExpression); Object find(String pathExpression); JSArray findAll(String pathExpression); List<JSNode> findAllNodes(String pathExpression); @Override Object put(String name, Object value); @Override void putAll(Map<? extends String, ? extends Object> map); Object putFirst(String name, Object value); JSNode with(Object... nvPairs); @Override boolean containsKey(Object name); @Override Object remove(Object name); Object remove(String... names); @Override Set<String> keySet(); boolean hasProperty(String name); Map<? extends String, ? extends Object> asMap(); JSNode copy(); void sortKeys(); boolean isArray(); @Override String toString(); String toString(boolean pretty); String toString(boolean pretty, boolean lowercasePropertyNames); @Override int size(); @Override boolean isEmpty(); @Override boolean containsValue(Object value); @Override void clear(); @Override Collection values(); @Override Set<Entry<String, Object>> entrySet(); List asList(); List<JSNode> asNodeList(); JSArray asArray(); Stream stream();  }### Answer:
@Test void fromJsonPath() { assertEquals("**.book.[(@_length-1)]", JSNode.fromJsonPath("$..book[(@.length-1)]")); assertEquals("**.book.[0,1]", JSNode.fromJsonPath("$..book[0,1]")); assertEquals("book.0.asdf", JSNode.fromJsonPath("book[0].asdf")); assertEquals(".store.**.price", JSNode.fromJsonPath(".store..price")); }