[HELP] JSON problem. help please

Hello guys, Im trying to make a ban system and save the bans that have been made in a .json file but it just won’t work.


this is how the bans get saved.

and the bans.json just have this in it:

image

also in the console it says that everything worked and the json code seems to be correct:

Are you sure the RemoveNilValues function works properly?

I think so but without it the code just writes “null” in the json file but print the json code correctly in the console again.

Can you show me where is the “json print”?


its this but i censored the data

I mean in the code

image

local didSave = SaveResourceFile
print(didSave)

it is the exact same thing like i did:

image

just replaced it with file and not didSave

use the same code to print it in save function above RemoveNilValues and again under RemoveNilValues

Not working.

No, you are checking if the file loaded, which almost ANY file will be read fine. You need to validate if your code is even actually thinking it did save the file in the first place. You are telling it “SaveThisFile”, and then not validating if that function actually went through. local didSave = SaveResouceFile gives you the return value of if the file actually saved. When that SaveResourceFile returns false, an issue arose that made the save fail, whether its a permission issue, a size issue, or whatever I coundn’t tell you how to deduce that properly, but I can say for certain if that native returns false you will never ever see that data stored in the file.

Why just SaveResourceFile?

I don’t understand what you are asking. I am telling you that you need to run code to validate your function is running in the first place. Your code as it stands right now seems to call
SaveResourceFile(stuff, otherstuff, more, stuff) print("This totally saved the file"):
Except that isn’t a validation that the file saved, that is validation that you attempted to save the file, that is validation that you called the native “SaveResourceFile”, but you have no actual validation that SaveResourceFile actually saved the file.
You need
local didSave = SaveResourceFile(stuff, otherstuff, more, stuff) print("The resource file totally "..((didSave and "did") or "did not").." save")

so you mean like this?

image

and thats the output?

i dont know what you mean.

or you mean like this?

then it gives this output:

image

The first bit of code is fine, it seems like the SaveResourceFile is returning that it did save. So, as soon as that native is finished running and prints to the console, if you open the file in a text editor it is still empty?

yeah there are just brackets inside like this “[_]”

image

Okay and your prints for the data in the table, are those done immediately before the save?

Yesss