Muzzleflash 111 Posted February 1, 2014 I've created a JSON parser for reading JSON files into sqf. Example of loading json file and into script: mydata.json { "name": "John Doe", "age": 34, "active": true, "qualifications": ["rifleman","grenadier"], "position": { "rank": "Private", "squad": "Bravo" } } your script, e.g. (init.sqf) //Load library [] call compile preProcessFile "json.sqf"; //Be sure to run in non-scheduled mode, otherwise the engine will halt parsing before completion. [] spawn { //Load data from json file _rawJson = loadFile "mydata.json"; _json = _rawJson call MF_Json_Parse; //Extract data from JSON structure _qualifications = [_json, "qualifications"] call MF_Json_Get; _rank = [_json, "position.rank"]; waitUntil {!isNull player}; //Update player attributes player setVariable ["MY_TAG_Qualifications", _qualifications, true]; player setRank (toUpper _rank); }; Performance is about 250 lines per second. It can handle files up to 10,000 lines, however, they will take extremely long to parse, and it is not intended for such huge amount of data. (It is still SQF). More information is available in the top of the script listed below. The script itself: /*** JSON Parser by Muzzleflash v0.987 --- To parse json _json = "JSON_STRING" call MF_Json_Parse _json now contains the JSON structure in SQF as described below. If some error occurs during parsing _json would be set to a string instead, so you to check for errors you should check whether the return is of type string. --- To ease use, MF_Json_Get can be used to read keys separated by period (.) It currently does not handle indexing into arrays --- Example Usage: FILE: mydata.json: { "name": "John Doe", "age": 34, "active": true, "qualifications": ["rifleman","grenadier"], "position": { "rank": "Private", "squad": "Bravo" } } Script: //Load library [] call compile preProcessFile "json.sqf"; _json = (loadFile "mydata.json") call MF_Json_Parse; //Find rank _rank = [_json, "position.rank"] call MF_Json_Get; --- How JSON data is mapped to SQF JSON objects map to: ["object", [[key_1, val_1], [key_2, val_2] ...]] JSON arrays map to: ["array", [val_1, val_2, val_3, ...]] JSON null maps to objNull The other JSON types maps to what you would expect, eg.: false, true, 123.456, "and strings" The above example would map to: ["object", [ ["name", "John Doe"], ["age", 34], ["active", true], ["qualifications", ["array", ["rifleman", "grenadier"]]], ["position", ["object", [ ["rank", "Private"], ["squad", "Bravo"] ]] ] ]] --- The only unsupported feature is \uXXXX inside strings. --- Performance notes Scheduled environment. (Do not parse in non-scheduled environment since the parsing is aborted halway by the engine) The second number in parantheses is the amount of time spent on lexing out of the total time taken. 254 lines (8577 chars) takes 0.81 (0.78) seconds 1010 lines (34693 chars) takes 3.29 (3.06) seconds 10082 lines (349246 chars) takes 34.19 (31.94) seconds On my budget non-server machine with 500 AI all engaged in battle simultaneous, the time to parse doubled. So expected performance is around 5000-10000 characters or 150-300 lines per second. ***/ //------ Getters MF_Json_Get = { private ["_node","_pathParts","_path","_node","_index"]; _node = _this select 0; _pathParts = (_this select 1) call MF_Json_PathParts; //For each part of the path { _part = _x; //Only objects have keys if (_node select 0 != "object") exitWith { _node = objNull; }; //Find index of key _index = -1; { if (_x select 0 == _part) exitWith { _index = _forEachIndex; }; } forEach (_node select 1); if (_index == -1) exitWith { _node = objNull; }; //Select child with the key matching the part _node = ((_node select 1) select _index) select 1; } forEach _pathParts; //Did client mean to extract array? if (typeName _node == typeName [] and {_node select 0 == "array"}) then { _node = _node select 1; }; _node }; MF_Json_PathParts = { private ["_path","_parts","_dot","_start"]; _path = toArray _this; _parts = []; _dot = toArray "." select 0; _start = 0; for "_i" from 0 to (count _path - 1) do { if (_path select _i == _dot) then { _parts set [count _parts, [_path, _start, _i - 1] call MF_Json_Lex_Extract]; _start = _i + 1; }; }; //Extract last part _parts set [count _parts, [_path, _start, count _path - 1] call MF_Json_Lex_Extract]; _parts }; //------ Parser MF_Json_Parse = { private ["_tokens","_parseState","_result"]; _tokens = _this call MF_Json_Lex; //Error? if (typeName _tokens == typeName "string") exitWith {_tokens}; _parseState = [_tokens, 0, ""]; _result = _parseState call MF_Json_Parse_Top; if (_parseState select 2 != "") exitWith {_parseState select 2}; _result }; MF_Json_SetError = { private ["_parseState", "_formatArgs"]; _parseState = _this select 0; _formatArgs = []; for "_i" from 1 to (count _this - 1) do { _formatArgs set [_i - 1, _this select _i]; }; _parseState set [2, format _formatArgs]; }; #define PARSE_TOKEN_TYPE (((_parseState select 0) select (_parseState select 1)) select 0) #define PARSE_TOKEN_VALUE (((_parseState select 0) select (_parseState select 1)) select 1) #define PARSE_HAS_ERROR (_parseState select 2 != "") #define PARSE_EXIT_IF_ERROR if PARSE_HAS_ERROR exitWith {_result}; #define PARSE_SET_ERROR(ERROR) [_parseState, "%1 at %2", ERROR, PARSE_TOKEN_VALUE] call MF_Json_SetError #define PARSE_SKIP if ((_parseState select 1) >= (count (_parseState select 0))) exitWith {[_parseState, "Expected more input after %1", ((_parseState select 0) select ((_parseState select 1) - 1))] call MF_Json_SetError;}; _parseState set [1, (_parseState select 1) + 1] #define PARSE_IGNORE(TOKEN) if (PARSE_TOKEN_TYPE != TOKEN) exitWith {[_parseState, "Expected token %1 near %2", TOKEN, PARSE_TOKEN_VALUE] call MF_Json_SetError;}; PARSE_SKIP #define PARSE_READ_VAL_INTO(VAR) VAR = PARSE_TOKEN_VALUE; PARSE_SKIP #define PARSE_COMPARE_CURRENT(VAL) (typeName PARSE_TOKEN_TYPE == typeName VAL and {PARSE_TOKEN_TYPE == VAL}) //JSON top level can only be object or array MF_Json_Parse_Top = { private ["_parseState"]; _parseState = _this; if (PARSE_TOKEN_TYPE == "lbrace") exitWith { _parseState call MF_Json_Parse_Object; }; if (PARSE_TOKEN_TYPE == "lbracket") exitWith { _parseState call MF_Json_Parse_Array; }; PARSE_SET_ERROR("Expected { or ["); }; MF_Json_Parse_Object = { private ["_parseState","_result","_kvArray","_key","_val"]; _parseState = _this; _kvArray = []; _result = ["object", _kvArray]; PARSE_IGNORE("lbrace"); if (PARSE_TOKEN_TYPE == "rbrace") exitWith { PARSE_SKIP; _result }; while {true} do { if (PARSE_TOKEN_TYPE != "string") exitWith { PARSE_SET_ERROR("String expected"); }; PARSE_READ_VAL_INTO(_key); PARSE_IGNORE("colon"); _val = _parseState call MF_Json_Parse_Value; PARSE_EXIT_IF_ERROR; _kvArray set [count _kvArray, [_key, _val]]; if (PARSE_TOKEN_TYPE == "rbrace") exitWith { PARSE_SKIP; _result }; if (PARSE_TOKEN_TYPE != "comma") exitWith { //Thanks for a buggy preprocessor , => comma PARSE_SET_ERROR("Expected comma or }"); }; PARSE_SKIP; }; _result }; MF_JSON_Parse_Array = { private ["_parseState","_array","_result","_val"]; _parseState = _this; _array = []; _result = ["array", _array]; PARSE_IGNORE("lbracket"); if (PARSE_TOKEN_TYPE == "rbracket") exitWith { PARSE_SKIP; _result }; while {true} do { _val = _parseState call MF_Json_Parse_Value; PARSE_EXIT_IF_ERROR; _array set [count _array, _val]; if (PARSE_TOKEN_TYPE == "rbracket") exitWith { PARSE_SKIP; _result }; if (PARSE_TOKEN_TYPE != "comma") exitWith { PARSE_SET_ERROR("Expected comma or ]"); }; PARSE_SKIP }; _result }; MF_Json_Parse_Value = { private ["_parseState","_result"]; _parseState = _this; if (PARSE_TOKEN_TYPE == "lbrace") exitWith { _parseState call MF_Json_Parse_Object }; if (PARSE_TOKEN_TYPE == "lbracket") exitWith { _parseState call MF_Json_Parse_Array }; if (PARSE_TOKEN_TYPE in ["string","number","bool","null"]) exitWith { PARSE_READ_VAL_INTO(_result); _result }; PARSE_SET_ERROR("Did not expect the value"); }; //----------------- Lexer MF_Json_Lex = { private ["_codePoints","_state","_startI","_currentI","_codePoint","_tokens","_error","_nextState","_action","_token"]; _codePoints = toArray _this; //EOF -- set does not work when the index is very large, even though still perfectly representable integer _codePoints set [count _codePoints, -1]; _state = 0; _startI = 0; _currentI = 0; _codePoint = _codePoints select _currentI; _tokens = []; _error = ""; scopeName "main"; while {true} do { //Skip blanks if (_state == 0 and (_codePoint in MF_Json_Blanks)) then { _currentI = _currentI + 1; _startI = _currentI; _codePoint = _codePoints select _currentI; } else { //Find next state _nextState = MF_Json_Lex_AcceptUnicodeTable select _state; //In table range? if (_codePoint >= 0 and _codePoint < 128) then { _nextState = (MF_Json_Lex_Table select _state) select _codePoint; }; //Token complete or bad input? if (_nextState == -1) then { //EOF? (Moved inside here for performance; yes it matters!) if (_state == 0 and _codePoint == -1) then { breakTo "main"; }; _action = MF_Json_Lex_AcceptingStates select _state; if (typeName _action == typeName -1) then { _error = format ["Lexer: Did not expect '%1' at this time", toString [_codePoint]]; breakTo "main"; }; //Extract token _token = [_codePoints, _startI, _currentI - 1] call _action; _tokens set [count _tokens, _token]; _nextState = 0; _startI = _currentI; } else { _currentI = _currentI + 1; _codePoint = _codePoints select _currentI; }; _state = _nextState; }; }; if (_error != "") exitWith {_error}; _tokens }; MF_Json_Lex_Extract = { private ["_codePoints","_fromI","_toI","_result"]; _codePoints = _this select 0; _fromI = _this select 1; _toI = _this select 2; _result = []; _result resize (_toI - _fromI + 1); for "_i" from _fromI to (_toI) do { _result set [_i - _fromI, _codePoints select _i]; }; toString _result }; MF_Json_Blanks = [32, 9, 10, 13]; //Lexer functions MF_Json_Lex_Func_Number = { ["number", parseNumber (_this call MF_Json_Lex_Extract)] }; MF_Json_Lex_Func_String = { //TODO: Handle unicode hexadecimal code points //Strip quotes ["string", [_this select 0, (_this select 1) + 1, (_this select 2) - 1] call MF_Json_Lex_Extract] }; MF_Json_Lex_Func_True = { ["bool", true] }; MF_Json_Lex_Func_False = { ["bool", false] }; MF_Json_Lex_Func_Null = { ["null", objNull] }; MF_Json_Lex_Func_Colon = { ["colon", ":"] }; MF_Json_Lex_Func_Comma = { ["comma", ","] }; MF_Json_Lex_Func_L_Brace = { ["lbrace", "{"] }; MF_Json_Lex_Func_L_Bracket = { ["lbracket", "["] }; MF_Json_Lex_Func_R_Brace = { ["rbrace", "}"] }; MF_Json_Lex_Func_R_Bracket = { ["rbracket", "]"] }; //-------- TABLES MF_Json_Lex_Table = [ //START, [-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,29,9,-1,-1,7,8,8,8,8,8,8,8,8,8,30,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 ]; MF_Json_Lex_AcceptingStates = [ -1,-1,-1,-1,-1,-1,-1,MF_Json_Lex_Func_Number,MF_Json_Lex_Func_Number,-1,-1,MF_Json_Lex_Func_Number,-1,-1,MF_Json_Lex_Func_Number,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,MF_Json_Lex_Func_L_Bracket,MF_Json_Lex_Func_R_Bracket,MF_Json_Lex_Func_L_Brace,MF_Json_Lex_Func_R_Brace,MF_Json_Lex_Func_Comma,MF_Json_Lex_Func_Colon,MF_Json_Lex_Func_String,MF_Json_Lex_Func_Null,MF_Json_Lex_Func_False,MF_Json_Lex_Func_True ]; Share this post Link to post Share on other sites
phoenix_za 23 Posted July 18, 2015 (edited) This is super awesome! I'll try it now. ----Edit I tried it and it still works beautifully! It will make life much easier implementing web integration for my group! Thanks so much for sharing! Edited July 18, 2015 by Phoenix_ZA Tried it Share this post Link to post Share on other sites
tupolov 520 Posted July 18, 2015 ALiVE also has two JSON parsing functions ALiVE_fnc_parseJSON and ALiVE_fnc_JSON. Share this post Link to post Share on other sites
phoenix_za 23 Posted July 18, 2015 That's awesome, and makes sense considering that you use MongoDB IIRC. Though I would like to use this in a mission framework and make that as mod agnostic as I can. Share this post Link to post Share on other sites