โ05-03-2018 11:31 AM
Hello. say i have the following JSON:
how can i remove one of the attributes / columns? Letโs say in the top left from the image above I want to remove the OwnerEmail value from that arrayโฆ how could i do that in snaplogic? iโve tried remapping but that breaks the grouping.
โ07-27-2018 12:56 AM
this isnt working for me!!
Could not compile expression: $group[].matchfield (Reason: Encountered extraneous input โ[โ at line 1:6; expecting={, โ||โ, โ&&โ, โ^โ, โ==โ, โ!=โ, โ>โ, โ<โ, โ>=โ, โ<=โ, โ+โ, โ-โ, '', โ/โ, โ%โ, โ?โ, โinstanceofโ, โinโ, โ.โ}; Resolution: Please check expression syntax)
โ07-27-2018 10:03 AM
Make sure the โTarget Pathโ column in the mapper is cleared. Otherwise, the mapper will treat the first column as an expression, which is what it looks like is happening here. (When the Target Path is clear, the first column is treated as a JSON-Path that specifies what should be deleted in the input document).
โ09-08-2021 07:00 PM
How would you do this conditionally? Meaning, if the incoming value is NULL, remove the property?
โ09-09-2021 12:57 AM
Hi @acesario,
There is an expression. You can remove all field that are null or only by specific fields.
For this you must use Mapper and you need to have checked Pass Through checkbox and also target path need to be empty.
$group...[?(value == null && key == "fieldName")]
$group: Is an array and if you remove the โgroupโ and let stay only โ$โ then it will work again but it will check through whole document.
value: We specify what value we want to remove. In this situation is null.
key: If we have to specify name of field that we want to remove, then we set key in the conditions. If we only need to check by value then remove the key. Ex: $group...[?(value == null)]
Regards,
Viktor Nedanovski
โ09-12-2021 07:09 PM
Very coolโฆ thank you!