Universal Script 📌
112.5k Views
128 Executions

Script Verified cJSON

Universal Script 📌
vxsty
vxsty
Verified Badge
Verified User
Hall of Fame10M views
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

cJSON is a script that helps developers reduce file sizes, whethere it is beautified JSON, JSON that was obtained from websites via pretty print, or just any JSON data. It uses simple techniques to compress text, such as sequences of the same letter with 4 bytes, 2 bytes to mark the compression, 1 to mark how many times to duplicate it, and 1 aka the original letter. Of course it only does that IF the 4 bytes are shorter than the original sequence, so it wont work for 3 letter and below sequences. It also uses base62 encoding for numbers to decrease their sizes! For example, take the number 1234567890, base62 converts it to 1ly7vk which is only 6 bytes (4 bytes shorter than the actual number), And then you can add 2 to the total length which marks the string as base62 encoded. Usage: cJ:Compress(Data: string): table -> {BytesCompressed: number = 0, Result: string = "", TimeTaken: float = 0.000000} cJ:Decompress(Data: string): string -> Decompresses already compressed cJSON. Feel free to DM me about any issues on my discord.

View Raw
-- cJSON: A new file extension which stands for compressed json.

local gsub, format, rep, sub, split, match, gmatch = string.gsub, string.format, string.rep, string.sub, string.split, string.match, string.gmatch;
local tinsert = table.insert;
local floor = math.floor;

local tostring, tonumber = tostring, tonumber;

-- * Base62 Start (Useful for number compression.)

local base62_chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

local base62 = { -- Very useful for compressing numbers, Can reduce sizes heavily when handling big numbers, for example: 1234567890 (#10) -> 1ly7vk (#6) which is 4 bytes shorter.
  index = {};
}

for i = 1, #base62_chars do
    base62.index[sub(base62_chars, i, i)] = i - 1
end

function base62.encode(num)
    local str = tostring(num);
    if #str == 1 then return str end -- Numbers like 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 always return "(number)" so we can just do that.
    num = tonumber(num);

    local result = ""
    while num > 0 do
        local remainder = num % 62
        result = sub(base62_chars, remainder + 1, remainder + 1) .. result
        num = floor(num / 62)
    end

    return result
end

function base62.decode(str)
    local result = 0

    for i = 1, #str do
        local char = sub(str, i, i)


Comments

8
Log in to join the conversation. Login
frzfrsy's profile picture
frzfrsy10 months ago

those flowers, are just not needed :sob:

1
vxsty's profile picture
vxstyVerified
Verified Badge
Verified User
Hall of FameUploader10 months ago

@frzfrsy 🥷 WHO are you

1
frzfrsy's profile picture
frzfrsy10 months ago

@vxsty indian new exploiter, music producer

1
vxsty's profile picture
vxstyVerified
Verified Badge
Verified User
Hall of FameUploader10 months ago

@frzfrsy the project is over a year old so please read the code before commenting anything (And it's still better than anything you can currently make!)

2
vxsty's profile picture
vxstyVerified
Verified Badge
Verified User
Hall of FameUploader2 years ago(edited)

@lelahcolonial453 ??? i made this on roblox studio, chatgpt does not give you such scripts, but since you seem to be experienced with chatgpt make him generate it

1
vxsty's profile picture
vxstyVerified
Verified Badge
Verified User
Hall of FameUploader2 years ago(edited)

@lelahcolonial453 ???? read the code buddy

1
lelahcolonial453's profile picture
lelahcolonial4532 years ago(edited)

@vxsty "please code the script without comments and the ugliest the possible but works" 💔💔

0
lelahcolonial453's profile picture
lelahcolonial4532 years ago(edited)

Lmao chatgpt made this

0

Tags

More universal scripts

See all
Script hub
51
2
2 days ago
Key System
Paid
Script hub
3.0M
14.6M
3 years ago

Script hub

Hall of Fame #1

KeylessVerified script badgeYARHM - MM2, FTF, Forsaken, etc.

Script hub
151
6
2 days ago
Key System
Universal Script 📌
4.7k
27.2k
4 months ago