-
-
Notifications
You must be signed in to change notification settings - Fork 22.2k
Automatic file saving reformats JSON file #105160
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
Comments
Indentation is already tracked in: So this should focus on the number formatting |
Hello, I think I'll try my hand at this one, if everyone's alright with that. I have an assignment at school where I have to contribute to a large open-source project. I will focus on number formatting, as suggested. Could I be assigned, please? |
In my opinion this doesn't need fixing. The JSON spec does not distinguish between When saving JSON in 4.4 the stringification result changed, this is expected. I think the only debate here is whether the editor should automatically save and therefore reformat all
You can start work without being assigned, we rarely use this GitHub feature. Sometimes priority issues are assigned to maintainers and active contributors, but it would be hard for us to track the progress on thousands of issues from hundreds of volunteer contributors. If you have trouble choosing an issue, you can look at the good first issue label, an issue triage project for the area of the engine you are interested in, or ask in the contributors chat. Good luck! |
Could this be a user-selected setting maybe? Perhaps under Project Settings -> General -> FileSystem -> Import ? |
I am all for an option to disable JSON resaving AND for an option to disable reformatting. My question still would be, why reformatting at all? What's the benefit? |
I find it surprising that Godot has to overwrite the JSON for any reason in the first place. This will cause plenty of file locking issues on Windows. Due to this, Godot should not be rewriting source files. If it has to perform any rewriting, it should be strictly contained to I guess what's happening here is that |
Is there a way to handle the issue where my ID fields, which are currently of type int/long, are being converted to float and causing all HTTP calls to the server using that ID to fail? For example, my server response looks like: {"id": 1234}, but when it's passed through Godot, it becomes 'id' = 1234.0, and if I send this ID back to the server, it results in a conversion error. |
@duongxinh2003 That's a separate issue and that's because JSON doesn't work the way you think it does. It doesn't have integers |
Tested versions
v4.4.1.stable.official [49a5bc7], but happens at least since Godot 4.4
System information
Windows 10, Godot 4.4
Issue description
I use an external program (for dialogues) that generates JSON files that I use directly in my Godot project. Godot decides to resave these JSON files from time to time and change the formatting. With Godot 4.4 not only the indents get changed, but also all number values get a ".0" if they were integer. This is bad for version control, and I really don't see the benefit of Godot saving and reformatting the JSON files at all.
Steps to reproduce
Create a JSON file from the outside and use it in a Godot project.
Minimal reproduction project (MRP)
N/A
The text was updated successfully, but these errors were encountered: