a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / serializeToJSON
serializeToJSON(
data
):string
Serializes a value to a JSON string.
This function takes any value, such as objects, arrays, numbers, strings, etc., and converts it into a JSON-formatted string. This is useful for storing or transmitting data in a format that is widely supported and can be easily parsed by other systems.
• data: unknown
The value to be serialized to JSON. This can be an object, array, string, number, etc.
string
A JSON string representing the serialized data.
const obj = { name: "John", age: 30 };
const jsonString = serializeToJSON(obj);
console.log(jsonString); // Output: '{"name":"John","age":30}'