JSON

paket "JSON";

The JSON package is used to work with JSON - JavaScript Object Notation. The package contains the following functions:

  1. objekatIzJSON
  2. JSONTekst

You will most likely need this package when working with an external API.

objekatIzJSON

The objekatIzJSON function is used to parse a Bosscript object out of a provided JSON string.

var obj = objekatIzJSON('{"x": 1, "y": true, "z": "hello"}');

ispis(obj);
Output:

{x: 1, y: tačno, z: "hello"}

JSONTekst

The JSONTekst function is used to stringify a Bosscript object into a JSON string:

var str = JSONTekst({x: 1, y: tačno, z: "hello"});
ispis(str);
Output:

{"x": 1, "y": true, "z": "hello"}