A script language of time-sharing scheduling coroutine in single thread
j = Import('json');
j.encode(array);
Input:
array - must be an array (regular array or dict).Return value:
false returned.Error:
j.decode(s);
Input:
s - must be a string.Return value:
false returned.Error:
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:
{"name":"Tom","age":18,"gender":"male"}
[Tom, 18, male, ]