Skip to content

json

Static Class

This object is a static class. It can be accessed by using its name as a keyword like this: json.

Additionally, it cannot be created in the creator menu or with Instance.New().

json is a module which allows for scripts to interface with JSON data representation by converting it to a table and vice versa.

Methods

isNull → boolean

Parameters: jsonString [ string ]

Returns true if the value specified is a null read from a json string

Example

print(json.isNull("{}"))

null → string

Returns a special value which is a representation of a null in a json

Example

print(json.null())

parse → Table

Parameters: jsonString [ string ]

Returns a table with the contents of the specified JSON string

Example

Http:Get("https://api.polytoria.com/v1/asset/owner?userID=1&assetID=234", function (data, error, errmsg)
    if error then
        print("Something went wrong!")
        return
    end

    print(json.parse(data)["Success"])
end)

serialize → string

Parameters: array [ array ]

Returns a json string with the contents of the specified table.

Example

print(json.serialize({
    Name = "Cool Sword",
    Damage = 10,
}))