JSON array with single item - Unique plugin expects an array

Created on 25 May 2023, almost 2 years ago

See 💬 JSON array with single item - Unique plugin expects an array Active - cannot move that issue to the Tamper issue queue

Problem/Motivation

Not sure if this is a bug or a support request.

When mapping JSON from a series of items, if the source array has a single item, the input is a string for that item.

The Unique tamper plugin throws an exception in this case.

However, the other items in the series (where the source has multiple items) are arrays.
So if we try to add the Explode plugin, that throws an exception.

Steps to reproduce

1. Set up a feed to import from a source with a series of JSON arrays, where some arrays have only one item
2. Map the array and add the Unique tamper plugin

For example, I'm importing from https://data.nationalgrideso.com/api/3/action/current_package_list_with_..., and mapping resources..format

Proposed resolution

tbc - for my use case, returning the input data instead of throwing an exception seems to work.
Need to consider other scenarios - it may be better to look at the way the JSON is processed, so that the value would always be an array.

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Needs review

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom malcomio

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024