Skip to content

deserialization changed uppercase to lowervase in nested hashes #2425

Open
@artofhuman

Description

Expected behavior vs actual behavior

input = {"include"=>"",
 "data"=>
  {"attributes"=>
    {"field_type"=>"dropdown",
     "name"=>"new field name",
     "description"=>"new field description",
     "enabled"=>false,
     "mandatory"=>true,
     "data"=>{"default_value"=>"new default value", "options"=>[{"OPTION 1"=>"OPTION 3"}, "new option 1", "new option 2"]}}},
 "controller"=>"api/v1/companies/custom_cv_fields",
 "action"=>"update",
 "company_id"=>"498",
 "id"=>"174"}

attention on nested hash "options"=>[{"OPTION 1"=>"OPTION 3"}

ActiveModelSerializers::Deserialization.jsonapi_parse(input)

=> {:field_type=>"dropdown",
 :name=>"new field name",
 :description=>"new field description",
 :enabled=>false,
 :mandatory=>true,
 :data=>{"default_value"=>"new default value", "options"=>[{"option 1"=>"OPTION 3"}, "new option 1", "new option 2"]}}

deserialization changes nested hashes. "options"=>[{"option 1"=>"OPTION 3"}

Expected behavior: deserialization should not change nested hashes

Environment

ActiveModelSerializers Version (commit ref if not on tag):
gem 'active_model_serializers', '~> 0.10.8'

Output of ruby -e "puts RUBY_DESCRIPTION":
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]

OS Type & Version:
Linux

Integrated application and version (e.g., Rails, Grape, etc):
Rails

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions