diff --git a/Userland/Utilities/json.cpp b/Userland/Utilities/json.cpp index 5cdac8db7d..38aba09482 100644 --- a/Userland/Utilities/json.cpp +++ b/Userland/Utilities/json.cpp @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include @@ -43,15 +43,11 @@ ErrorOr serenity_main(Main::Arguments arguments) VERIFY(spaces_in_indent >= 0); args_parser.parse(arguments); - RefPtr file; - if (path == nullptr) - file = Core::File::standard_input(); - else - file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); + auto file = TRY(Core::Stream::File::open_file_or_standard_stream(path, Core::Stream::OpenMode::Read)); TRY(Core::System::pledge("stdio")); - auto file_contents = file->read_all(); + auto file_contents = TRY(file->read_all()); auto json = TRY(JsonValue::from_string(file_contents)); if (!dotted_key.is_empty()) { auto key_parts = dotted_key.split_view('.');