Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 908 Bytes

File metadata and controls

27 lines (20 loc) · 908 Bytes

JSON

Namespace: SpawnDev.SpawnJS.JSObjects
Inheritance: Static class
MDN Reference: JSON - MDN

Wraps the JavaScript JSON object. Provides static methods for parsing and stringifying JSON using the browser's native JSON engine.

Static Methods

Method Return Type Description
Parse<T>(string json) T Parses a JSON string and returns the result as type T.
Stringify(object value) string Converts a value to a JSON string.
Stringify(object value, object replacer, int space) string Stringifies with formatting options.

Example

// Parse JSON
string json = "{\"name\":\"TJ\",\"age\":42}";
using var obj = JSON.Parse<SpawnJSObject>(json);

// Stringify
string output = JSON.Stringify(obj);
Console.WriteLine(output);