Releases: clugg/sm-json
v5.0.1
v5.0.0
Changed
- Ordered key tracking is now default behaviour. All objects will keep track of the order their keys are seen in and respect it during encoding. This fixes an issue with sharing snapshots between plugins (#34).
- The iteration API has changed - instead of
obj.Iterate(), useobj.Length. No other changes are required. JSON_Array.GetIndexAsStringhas been renamed toGetKeyfor consistency withJSON_Object
- The iteration API has changed - instead of
Removed
JSON_DECODE_ORDERED_KEYS(option)JSON_ORDERED_KEYS_KEY(metadata key)JSON_SNAP_KEY(metadata key)JSON_Object.OrderedKeysJSON_Object.SnapJSON_Object.Iterate()JSON_Object.EnableOrderedKeys()
Thanks to @nickdnk for raising the relevant bug.
v4.1.3
Fixed
JSON_Array.GetOptionalValue's types were incorrectJSON_Object.GetInt64's docblock was incorrect- Fixed issues with 'ordered keys' behaviour (existing since v4.0.0)
- Fixed keys being tracked more than once when setters are called multiple times. This fixes many bugs stemming from iteration not working as expected.
- When decoding objects with duplicate keys, the key's order is now based on its last occurrence. For example, decoding
{"a":1,"b":2,"a":3}will result in a JSON object equivalent to{"b":2,"a":3}(#32)
- Attempting to deep copy JSON instances which contain a
nullvalue will no longer throw an error (#35) - A bug with incorrect indexing of hidden keys during
JSON_Array.Concathas been fixed (#35)
Thanks to @nickdnk for contributing to this.
v4.1.2
v4.1.1
v4.1.0
v4.0.0
Added
-
Added support for Int64s using Sourcemod's native
Int64ToStringandStringToInt64methods (requires SourceMod 1.11-6861 or later) (#25)- For more information, check out the following documentation:
-
Added optional tracking of key order insertion in objects. This will ensure that keys are iterated over (including during encoding) in the same order that they are set. This can be enabled by calling
EnableOrderedKeysor passingJSON_DECODE_ORDERED_KEYSas an option tojson_decode. (#19) -
Add support for calculating required buffer size for encoded output
- For more information, check out the following documentation:
-
Add support for reading from/writing to files (#20)
- For more information, check out the following documentation:
Changed
-
SourceMod 1.8 and 1.9 are no longer officially supported.
-
Data is now isolated within a nested StringMap, removing any potential for key clashes and allowing for more internal freedom when managing metadata
-
The API for iterating over objects has changed - you must now use the following methods instead of creating a snapshot yourself - please review the README example for more information
Please see this comment for more detail on the above two points.
-
The decoder now defines an int64 as any value outside the signed int32 range when using a supporting SourceMod version (1.11-6861 or later)
-
HasKeywill now useStringMap.ContainsKeyunder the hood when using a supporting SourceMod version (1.11-6646 or later) (thanks to @MAGNAT2645 for #24) -
JSON_Array'sSetTypehas been renamed toEnforceType -
The following methods have been renamed on
JSON_ObjectandJSON_Array:GetMetadata->GetMetaSetMetadata->SetMetaRemoveMetadata->RemoveMetaGetKeyType->GetTypeSetKeyType->SetTypeGetKeyLength->GetSizeNote: this now returns the length of the string + 1 to account for a NULL terminatorSetKeyLength->SetSizeGetKeyHidden->GetHiddenSetKeyHidden->SetHidden
-
JSON_Meta_Lengthhas been renamed toJSON_Meta_Size -
The logic for
json_mergehas been split intoMergeandConcatmethods for objects and arrays respectively. -
json_cleanupnow alsodeletes the object passed in -
json_cleanup_and_deleteworks effectively the same but deletion is now handled withinjson_cleanup
Removed
json_string_startswithjson_string_endswithjson_is_meta_key
v3.3.1
v3.3.0
Added
- Added ability to rename keys on objects by @alexevladgabriel, @MAGNAT2645 and @clugg (docs) (#21)
Changed
- Fix SM1.11 compatibility (see 1dae33a)
- Update sm-testsuite to v1.2.2