Export model dependencies into JSON

I want to add a “security” feature to a model I’m making. And an easy way to update the model. I want to export the dependencies to something like JSON. Once the game loads, I want it to create all the instances with the properties inside each other from that JSON (excluding scripts).

Example: Model>Part>SurfaceGui>Frame>TextLabel, TextButton

2 Likes

You can do this with Rojo, or just save the Model to disk as a rbxmx (XML) file

1 Like

Once the game loads, I want it to create all the instances with the properties inside each other from that JSON (excluding scripts).

I want to make a script that makes the objects and all of the properties from the XML

1 Like

I want something like this:

{
  "Part": [
    {
      "type": "SurfaceGui",
      "parent": "Part",
      "name": "Main"
    },
    {
      "type": "Frame",
      "parent": "Part>Main",
      "name": "TestFrame"
    },
    {
      "type": "TextButton",
      "parent": "Part>Main>TestFrame",
      "name": "CoolButton"
    }
  ]
}

I want it to export like this and make a script read and make instances that match the properties

Can someone please respond? I need help,

You can create a table, then use HttpService:JSONDecode(table), then you should get like what you expected, also use :GetFullName(), do something like this

local HttpService = game:GetService("HttpService")

local tab = {
	Model = {
		{
			type = "Part",
			Parent = script.Parent.Part:GetFullName(),
			Name = "Part"
		}
	}
}

HttpService:JSONEncode(tab)

then you should get this when you convert it to JSON

{
   "Model": [
      {
         "type": "Part",
         "parent": "game.Workspace.Model.Part",
         "Name": "Part"
      }
   ]
}

I wan’t it to automatically scan through the model and add the object and it’s properties to the JSON.