Module basic module

Module json

json encoding and decoding module

Reference method:

1 2
var encoding = require('encoding'); var json = encoding.json;

or

1
var json = require('json');

Static function

encode

Encode variables in json format

1
static String json.encode(Value data);

Call parameters:

  • data: Value, the variable to be encoded

Return result:

  • String, Return the encoded string

decode

Decode the string as a variable in json way

1
static Value json.decode(String data);

Call parameters:

  • data: String, the string to be decoded

Return result:

  • Value, Return the decoded variable