Skip to content

question: Dynamic Object Transform #1394

Open
@dima-getselectstar

Description

@dima-getselectstar

I was trying to transform dynamic object props, but can't figure it out. Let's assume we have an object with dynamic props as following:

info_details: {[randomId]: {user_names: [ 'Julia', 'Alex' ] } }

The problem:

Normally we would use something like this:

class A {
  @Expose({ name: 'user_names' })
  userNames!: string[];
}

class B {
  @Expose({ name: 'info_details' })
  @Type(() => A)
  infoDetails!: A;
}

But in the case when randomId is a dynamic prop and we cannot define a class to it I don't really know what would be the best way to parse that object. Could you help please?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions