2019-08-07 23:02:00 +02:00
|
|
|
# sharp-json
|
2017-11-03 13:20:23 +01:00
|
|
|
A lightweight JSON implementation for Mono/.NET
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2019-08-07 23:02:00 +02:00
|
|
|
Use the base type *ln.json.JSON* to represent JSON variables.
|
2017-11-03 13:20:23 +01:00
|
|
|
|
2019-08-07 23:02:00 +02:00
|
|
|
import ln.json;
|
2017-11-03 13:20:23 +01:00
|
|
|
...
|
|
|
|
JSON n = 123.45;
|
|
|
|
JSON s = "Hello World!"
|
|
|
|
|
|
|
|
Console.WriteLine("A number: {0}",n.ToString());
|
|
|
|
Console.WriteLine("A String: {0}",s.ToString());
|
|
|
|
|
|
|
|
To parse JSON from text you may use
|
|
|
|
|
|
|
|
JSONParser parser = new JSONParser();
|
|
|
|
JSON json = parser.Parse("[ 0, 1, 2, 3 ]");
|
|
|
|
|
|
|
|
Console.WriteLine("json: {0}",json);
|
|
|
|
|