-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BREAKING(std/fs): remove readJson and readJsonSync #7255
BREAKING(std/fs): remove readJson and readJsonSync #7255
Conversation
87b82d6
to
6ba4883
Compare
I was happily using them in my code! I think these functions are a nice addition to Deno. JSON is a very common file type especially in JS/TS projects. Moreover, if the same can be achieved easily with a longer code, it is an argument to keep it in Deno because it is easy to main + it makes people's life easier for handling JSON files. |
@lcswillems thanks for the comment. If I'm not mistaken I think we should go ahead with removal in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @caspervonb
Mhm, broke many things here =)...but from an engineering standpoint I agree, was actually about to file an issue that readJson should support JSON.parse() reviver functions... as we have to use JSON.parse anyways, that issue is one less =)... |
I have ported the |
This removes readJson and readJsonSync from std/fs entirely as they are fairly peculiar functions and the only ones in the std/fs namespace that deals with file input and they only deal with reading JSON from a text file which is very specialized.
The same can be achieved quite easily with
JSON.parse(await Deno.readTextFile("path/to/input.json"));
as-well asJSON.parse(Deno.readTextFileSync("path/to/input.json"));
for the synchronous version.