Skip to content

Cannot pass Serializable objects in bundle while placing API call #5

Description

@mohitajwani

I am working on a project with this library. I have an API call that accepts the following payload

{
  "first_name": "Mohit",
  "age": 27,
  "address": {
    "line1": "abc",
    "line2": "def",
    "pincode": 400000
  }
}

So, my User Object here has another Serializable Object called Address. I am unable to pass the model as it is in the Bundle by using the following snippet.

Bundle bundle = new Bundle();
bundle.putString("first_name", user.getFirstName());
bundle.putInt("age", user.getAge());
bundle.putSerializable("address", user.getAddress());

The API always gives 503 since the convertToJSON method in the BundleJSONConverter class gives "Unsupported type" exception always because the recursive call makes the class makes the Setter null as the Address object is not a List<T> or a Bundle.

Can you please fix this? Or suggest a workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions