[]\n"; print "If no json file is given it defaults to the json specified in http://goessner.net/articles/JsonPath/index.html#e3\n"; die(); break; case 3: $json = file_get_contents($argv[2]); default: $jsonPath = $argv[1]; } try { $jsonObject = new JsonObject($json); } catch (InvalidJsonException $e) { print "Invalid JSON error: '" . $e->getMessage() . "'\r\n"; die(); } try { $r = $jsonObject->get($jsonPath); } catch (InvalidJsonPathException $e) { print "Invalid JSONPath error: '" . $e->getMessage() . "'\r\n"; die(); } if ($r === false) { print "false"; } else { print json_encode($r); } print "\r\n";