Skip to content

Jbuilder #merge! doesn't follow json.key_format! rule #473

Closed
@aruprakshit

Description

@aruprakshit

I have in my partial:

json.key_format! camelize: :lower

json.credit_balance @user.available_credits
json.company_state @user.company_profile.state
json.subscription do
  json.merge! @user.subscription.to_h
end

But rendered json doesn't produced by following camelize: :lower rule.

{
  "creditBalance": 28,
  "companyState": "NJ",
  "subscription": {
    "active": true,
    "current_period_end": "03/02/2020"
  }
}

See current_period_end should be currentPeriodEnd.

I am using Rails 5.2.

Metadata

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