Author: Vlad
Author Website:

Requirements: No addons required

Version: 1.00
Signed: Yes, serverkey included

Short description: is a library for working with data in JSON format.

Date: 2019-07-06 10:08


Comments: (0)
Rating:



 







JSON

by
Vlad


Description:
Library for working with data in JSON format.

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
JSON5


Installation:
To install JSON you should use modfolders to keep it seperate from the official game content to prevent issues.
With Arma 3 you can use different ways to set up your modfolders to use custom content you have downloaded.
Please visit the Arma 3 Mod install instructions page for more information about using custom mods and addons in Arma 3.


Included files:
json.pbo


Usage:
For usage instructions and information of how to use the JSON please refer to the included documentation and/or example mission.

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;


Notes:
Addon is under development, any suggestions and comments are welcome


Changelog:
1.00


Steam Workshop:
- Subscribe




Enable javascript to be able to download from Armaholic please!