Skip to content

Releases: clugg/sm-json

v5.0.1

16 Nov 10:52

Choose a tag to compare

Changed

  • Removed unused parameter is_array from json_extract_string_size (#37)

Thanks to @Neptune196 for raising the relevant issue and to @fbef0102 for testing.

v5.0.0

27 Mar 14:03

Choose a tag to compare

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(), use obj.Length. No other changes are required.
    • JSON_Array.GetIndexAsString has been renamed to GetKey for consistency with JSON_Object

Removed

  • JSON_DECODE_ORDERED_KEYS (option)
  • JSON_ORDERED_KEYS_KEY (metadata key)
  • JSON_SNAP_KEY (metadata key)
  • JSON_Object.OrderedKeys
  • JSON_Object.Snap
  • JSON_Object.Iterate()
  • JSON_Object.EnableOrderedKeys()

Thanks to @nickdnk for raising the relevant bug.

v4.1.3

27 Mar 13:45

Choose a tag to compare

Fixed

  • JSON_Array.GetOptionalValue's types were incorrect
  • JSON_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 null value will no longer throw an error (#35)
  • A bug with incorrect indexing of hidden keys during JSON_Array.Concat has been fixed (#35)

Thanks to @nickdnk for contributing to this.

v4.1.2

22 Feb 10:19

Choose a tag to compare

Changed

v4.1.1

03 Jul 03:06

Choose a tag to compare

Changed

  • Fixed json_read_from_file not closing files after reading (#27)

v4.1.0

18 Apr 10:09

Choose a tag to compare

Changed

v4.0.0

11 Mar 11:01

Choose a tag to compare

Added

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)

  • HasKey will now use StringMap.ContainsKey under the hood when using a supporting SourceMod version (1.11-6646 or later) (thanks to @MAGNAT2645 for #24)

  • JSON_Array's SetType has been renamed to EnforceType

  • The following methods have been renamed on JSON_Object and JSON_Array:

    • GetMetadata -> GetMeta
    • SetMetadata -> SetMeta
    • RemoveMetadata -> RemoveMeta
    • GetKeyType -> GetType
    • SetKeyType -> SetType
    • GetKeyLength -> GetSize Note: this now returns the length of the string + 1 to account for a NULL terminator
    • SetKeyLength -> SetSize
    • GetKeyHidden -> GetHidden
    • SetKeyHidden -> SetHidden
  • JSON_Meta_Length has been renamed to JSON_Meta_Size

  • The logic for json_merge has been split into Merge and Concat methods for objects and arrays respectively.

  • json_cleanup now also deletes the object passed in

  • json_cleanup_and_delete works effectively the same but deletion is now handled within json_cleanup

Removed

  • json_string_startswith
  • json_string_endswith
  • json_is_meta_key

v3.3.1

12 Feb 01:22

Choose a tag to compare

This marks the final release of v3.x.

Changed

  • General housekeeping (code formatting, doc updates)

v3.3.0

08 Feb 13:42

Choose a tag to compare

Added

Changed

  • Fix SM1.11 compatibility (see 1dae33a)
  • Update sm-testsuite to v1.2.2

v3.2.2

17 Jan 08:47

Choose a tag to compare

Changed

  • Fixed missing delete calls to snapshots by @nickdnk in #23