Skip to content

Is there a way to escape all values in a nested object when the keys are unknown? #1137

@mmacdo54

Description

@mmacdo54

Say I have a req.body like so

{ user_info: { custom: { '63': 'aaaaaaaa' }, email: 'test@test.com', name: 'A Name', } }

I want run body().escape() on it all but when I do I get custom as '[object Object]'.

The thing to note here is I will not know what keys are inside custom and also I will not know what keys are inside user_info. The fields that come through are completely unknown. So I have tried [body('user_info.custom.*').escape(), body('user_info.*).escape()] but this still return custom as [object Object]. I really just want to escape every key that comes through. But is this possible when I dont know the key names and it is nested like this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions