Melang

Logo

A script language of time-sharing scheduling coroutine in single thread

View the Project on GitHub Water-Melon/Melang

JSON

Import

j = Import('json');
encode
j.encode(array);

Input:

Return value:

Error:

decode
j.decode(s);

Input:

Return value:

Error:

Example
j = Import('json');
sys = Import('sys');

a = ['name': 'Tom', 'age': 18, 'gender': 'male'];
json = j.encode(a);
sys.print(json);
sys.print(j.decode(json));

The output is:

{"age":18.000000,"name":"Tom","gender":"male"}
[18.000000, Tom, male, ]