Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Benbebop/Rblx-Save-As-JSON-Source

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Source Code for the plugin Save as JSON

Source.lua

Source.lua is the raw source code, nothing added or modified.

Module.lua

Module.lua is for use in-game, in a module script.

First get the latest API dump.

Fetch the current version hash then fetch the latest API dump by replacing <HASH> in the following URL with the retrieved version hash:

http://setup.roblox.com/<HASH>-API-Dump.json

Then require Module.lua and call setup().

local saveAsJSON = require(module)

saveAsJSON:setup(dumpContent)

You can now use ether decode() or encode() depending on what you want.

local saveAsJSON = require(module)

saveAsJSON:setup(dumpContent)

--[[encode takes a table of instances to encode and a "compression mode". Compression mode can be:
- "none" (all properties)
- "lossless" (removes unchanged values)
- "lossy" (compresses some values)]]

local JSONData = saveAsJSON:encode({game.Workspace.Part}, "none") 

-- decode just takes JSON data as a string

saveAsJSON:decode(JSONData) 

jsonExtendedDataTypes.lua

jsonExtendedDataTypes.lua is all the functions I use to convert Roblox data types to JSON compatable data types. This is applicable to any JSON project, that's why its a seperate script.

Require the module then index the functions via whatever typeOf(value) spits out.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages