Writing to JSON files

Here is my JSON file data:

In studio, I’m able to read it using HttpService, but I’m unsure how I write to it, and change the content.
Already looked around the web and was unable to find anything, hence why I’m making this topic.

(Here is what I am using to read the data. JSON is valid, everything here is fine)
image

Not much else to add- any help is appreciated! :relaxed:

You use :JSONEncode if you want to transform lua into a json file. (If this is what you mean)

1 Like

I want to change the JSON data on the http server, think of it like this:

  • Read the data from the external server
  • Change the data on the external server
  • Read the data again, this time it will be different because changes have been made

You could try something like this


local Success, Returned = pcall(function()
    return http:PostAsync(url) -- Put in your parameters (what your sending to the external server)
end)

if Success then
    -- red data again, changes should have been made
else
    -- parse the http error
end
1 Like

This might help you: Create and Consume Simple REST API in PHP | All PHP Tricks
You would also need to open up the firewall to allow connections from other computers.

2 Likes