anchor.diff:      Term;
   encode_record(key, Term, integer) when is_integer(Term) ->
       integer_to_binary(Term);
  +encode_record(key, Term, integer) when is_float(Term) andalso (Term =:= float(round(Term))) ->
  +    integer_to_binary(round(Term));
   encode_record(value, Term, integer) when is_integer(Term) ->
       Term;
  -encode_record(value, Term, float) when is_integer(Term) ->
  -    float_to_binary(float(Term));
  +encode_record(value, Term, integer) when is_float(Term) andalso (Term =:= float(round(Term))) ->
  +    round(Term);
   encode_record(key, Term, float) when is_float(Term) ->
       float_to_binary(Term);
  +encode_record(key, Term, float) when is_integer(Term) ->
  +    float_to_binary(float(Term));
   encode_record(value, Term, float) when is_float(Term) ->
       Term;
  +encode_record(value, Term, float) when is_integer(Term) ->
  +    float(Term);
   encode_record(value, Term, #{} = Struct) when is_map(Term) ->
       [{KeyType, ValueType}] = maps:to_list(Struct),
       {maps:fold(
  
positive.code: 
  
  %%%===================================================================
  %%% Definitions
  %%%===================================================================
  
  %% Encoded record name field
  -define(RECORD_TYPE_MARKER, "<record_type>").
  
  %% Encoded record version field
  -define(RECORD_VERSION_MARKER, "<record_version>").
  
  
  %%%===================================================================
  %%% Types
  %%%===================================================================
  
  -type field_name() :: atom().
  -type record_key() :: binary | atom | integer | term | string.
  -type record_value() :: json %% Raw JSON binary
      %% or simple types
      | record_key() | boolean | [record_struct()] | {record_struct()} | #{record_key() => record_struct()}
      %% or custom value - executes Mod:Encoder(GivenTerm) while encoding and Mod:Decoder(SavedJSON) while decoding.
      %% Encoder shall return JSON binary, Decoder shall decode JSON binary to original term.
      | {custom_value, {Mod :: atom(), Encoder :: atom(), Decoder :: atom()}}
      %% or custom value - executes Mod:Encoder(TypeName, GivenTerm) while encoding and Mod:Decoder(TypeName, SavedJSON) while decoding.
      %% Encoder shall return JSON binary, Decoder shall decode JSON binary to original term.
      %% You can specify only module name, Decoder defaults to 'encode_value', Decoder defaults to 'decode_value'
      | {custom_type, TypeName :: atom(), Mod :: atom()} | {custom_type, TypeName :: atom(), {Mod :: atom(), Encoder :: atom(), Decoder :: atom()}}.
  -type record_version() :: non_neg_integer().
  -type record_struct() :: record_value()
      | {record, record_version(), [{field_name(), record_value()}]} %% Used only internally
      | {record, [{field_name(), record_value()}]} %% For defining model structure
      | {record, model_behaviour:model_type()}. %% For referencing nasted model
  -type ejson() :: term(). %% eJSON
  
  
  
negative.code: %%--------------------------------------------------------------------
  -spec decode_record(ejson()) -> {record_version(), term()}.
  decode_record({Term}) when is_list(Term) ->
      ModelName0 = decode_record(proplists:get_value(<<?RECORD_TYPE_MARKER>>, Term), atom),
      Version = decode_record(proplists:get_value(<<?RECORD_VERSION_MARKER>>, Term), integer),
      ModelName = maybe_rename_model(ModelName0, Version),
      {record, Fields} = ModelName:record_struct(Version),
      {Version, decode_record({Term}, {record, Version, Fields})}.
  
  %%--------------------------------------------------------------------
  