Skip to content

How to transform complex objects in a list? #298

@haufes

Description

@haufes

I’m trying to perform a transform on elected in an array. I need to update object in an array that has a matching key. If the key matches I need to change the key as well add an Id to the object.

Example payload

{
	"items": [
		{
		    "id": "234234235",
		    "keyTypeA": "One"
		},
		{
	        "keyTypeA": "One"
		},
		{
	        "keyTypeA": "Two"
		},
		{
	        "keyTypeB": "Red"
		}
	]
}

Transformed into

{
	"items": [
		{
		    "id": "987234345",
		    "keyTypeA": "Three"
		},
		{
		    "id": "987234345",
		    "keyTypeA": "Three"
		},
		{
	        "keyTypeA": "Two"
		},
		{
	        "keyTypeB": "Red"
		}
	]
}

Any advice would be appreciated.

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