Skip to content

Latest commit

 

History

History
56 lines (47 loc) · 918 Bytes

README.md

File metadata and controls

56 lines (47 loc) · 918 Bytes

CSharpJSON

JSON Data Management

Basic usage

import GI;
...

class Test {
  void Main() {
    // Init
    JSON data = new JSON(JSONType.Object);
    
    // Set
    data["string"] = new JSON("Bar");
    data["number"] = new JSON(100);
    data["bool"] = new JSON(true);
    data["null"] = new JSON();
    data.ObjAdd("time", new JSON(DateTime.Now));
    
    // Get
    int num = data["number"].NumberValue;
    string str = data["string"].StringValue;
    bool bol = data["bool"].BoolValue;
    object obj = data["null"].Value;
  }
}

Basic deserialize / parse

import GI;
...

class Test {
  void Main() {
    string jstr = "{\"foo\": \"bar\", \"num\": 5}";
    JSON data = JSON.Parse(jstr);
  }
}

Basic serialize / encode

import GI;
...

class Test {
  void Main() {
    JSON data = new JSON("foo");
    MessageBox.Show(data.ToString());
  }
}

Contribute are welcome XD