Arma 3
Not enough ratings
[WIP] JSON
   
Award
Favorite
Favorited
Unfavorite
Data Type: Mod
File Size
Posted
0.120 MB
Jul 4, 2019 @ 5:41pm
1 Change Note ( view )

Subscribe to download
[WIP] JSON

Description
Addon is under development, any suggestions and comments are welcome

Description
Library for working with data in JSON[www.json.org] format.

Data structure
JSON
SQF
object
ARRAY: [{}, [["key1", value1], ["key2", value2], ...]]
array
ARRAY: [[], [value1, value2, ...]
string
STRING: "string"
number
SCALAR: 123
true
BOOL: true
false
BOOL: false
null
OBJECT: objNull

Usage
Import data from clipboard or file to sqf:
data = ["CLIPBOARD"] call JSON_fnc_import; data = ["FILE", "path\to\file.json"] call JSON_fnc_import;
Export data to clipboard:
[data, "CLIPBOARD_MIN"] call JSON_fnc_export;
Parsing string with json data:
data = [string] call JSON_fnc_parse;
Stringify data:
string = [data] call JSON_fnc_str;
Read data:
// Object value = [data, ["key1", "key2", ...]] call JSON_fnc_get; // Array value = [data, [index1, index2, ...]] call JSON_fnc_get; // Mixed value = [data, ["key1" or index1, "key2" or index2, ...]] call JSON_fnc_get;
Write data:
// Object [data, ["key1", "key2", ...], value] call JSON_fnc_set; // Array [data, [index1, index2, ...], value] call JSON_fnc_set; // Mixed [data, ["key1" or index1, "key2" or index2, ...], value] call JSON_fnc_set;

Applications?
  • Replacement to userconfig (Direct inclusion of userconfig is insecure)
  • Configuration files for missions and addons
  • Integration with extensions (Many programming languages have libraries for working with the data in JSON format)
  • Small step towards object-oriented programming (Note: not all SQF data types are supported, only those supported by JSON format)

WIP
< >
1 Comments
goobin Jul 18, 2020 @ 6:02am 
This is sweet dude, nice work