-
Notifications
You must be signed in to change notification settings - Fork 21
mapping array without functions #214
Description
Hey there, love the plugin. I wanted to give feedback on my usecase / problem.
I am trying to provide a wide range of mapping posibilities to the end user as part of an extensively configurable interface. incoming data will come from a range of different systems, some I will not know about myself. Thus i want to provide a way for end users to configure their own mappings. This plugin so far was perfect, as i could allow users to place json files in a config folder with different mappings for different triggers.
Where i get stuck however is on arrays. Morphism requires me to use a function to map data to a destination array. And functions, for valid security reasons, cannot and should not be part of the json standard.
i am not looking for complex data translation functions, merely allowing the end user to shuffle object fields and arrays.
A simple example:
incoming:
"client": {
"source": "mko",
"externalId": "123",
"lastname": "efal",
"initials": "T",
"addresses": [
{
"streetname": "dam 1",
"postalcode": "1101AA",
},
{
"streetname": "dam 2",
"postalcode": "1102AA",
}
]
}
}
impossible mapping.json:
"source": "client.source",
"externalId": "client.externalId",
"lastname": "client.lastname",
"initials": "client.initials",
"addresses": ??
}
Describe the solution you'd like
I would ideally see some supported syntax for simple array translation without functions, such as:
"source": "client.source",
"externalId": "client.externalId",
"lastname": "client.lastname",
"initials": "client.initials",
"addresses": {
_array: "client.addresses"
"streetname": "_.streetname",
"postalcode": "_.postalcode",
}
}