fromJSON: Difference between revisions
Lou Montana (talk | contribs) (Page creation) |
Hypoxic125 (talk | contribs) m (added example for hashmap) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 3: | Line 3: | ||
|game1= arma3 | |game1= arma3 | ||
|version1= 2.18 | |version1= 2.18 | ||
|gr1= Strings | |gr1= Strings | ||
Line 25: | Line 23: | ||
|x1= <sqf> | |x1= <sqf> | ||
private _myNumber = fromJSON "42"; | private _myNumber = fromJSON "42"; // _myNumber is 42 | ||
private _myString = fromJSON """Hello there"""; | private _myString = fromJSON """Hello there"""; // _myString is "Hello there" | ||
private _myArray = fromJSON "[42, ""Hello there"", true]"; // _myArray is [42, "Hello there", true] | private _myArray = fromJSON "[42, ""Hello there"", true]"; // _myArray is [42, "Hello there", true] | ||
private _myHash = fromJSON "{""key1"": ""value1"", ""key2"": ""value2""}" // _myHash is [["key2", "value2"], ["key1", "value1"]] | |||
// Important: [] indicates array, {} and : indicates hash | |||
</sqf> | </sqf> | ||
|seealso= [[toJSON]] [[parseSimpleArray]] | |seealso= [[toJSON]] [[parseSimpleArray]] | ||
}} | }} |
Latest revision as of 04:36, 29 April 2025
Description
Syntax
Examples
- Example 1:
- private _myNumber = fromJSON "42"; // _myNumber is 42 private _myString = fromJSON """Hello there"""; // _myString is "Hello there" private _myArray = fromJSON "[42, ""Hello there"", true]"; // _myArray is [42, "Hello there", true] private _myHash = fromJSON "{""key1"": ""value1"", ""key2"": ""value2""}" // _myHash is [["key2", "value2"], ["key1", "value1"]] // Important: [] indicates array, {} and : indicates hash
Additional Information
- See also:
- toJSON parseSimpleArray
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note