chargebee / chargebee-ruby

Ruby library for the Chargebee API.

Home Page:https://apidocs.chargebee.com/docs/api?lang=ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested array attributes are incorrectly serialized

gerbal opened this issue · comments

According to the Chargebee documentations, when a coupon with nested attributes is serialized, the path of the nested attributes should be preserved and double-nested arrays should be json encoded as arrays.

{"item_constraints": [{"item_price_ids": ["id1"]}]}

Is expected to be serialized to parameters as:

item_constraints[item_price_ids][0]=["id1"] 

However when this resource is serialized using this library, the nested array is not correctly nested

ChargeBee::Util.serialize({item_constraints: [{item_price_ids: ['id1']}]})

=> {"item_price_ids[0]"=>"id1"}

Closing this issue as its been resolved in latest release v2.13.1.

Hi, You should be passing this jsonarray as string '["id1","id2"]' within single quotes as this field is not list of values.