This project has moved. For the latest updates, please go here.

How to handle empty arrays

Topics: Bug / Problems
Mar 1 at 11:40 AM
Hi,

I'm trying to insert many json files via a for each loop container. This works so far.
But in some files not all arrays are populated with data.
For example the "markups" array.
  "markups": [
    {
      "name": "YIELD1",
      "value": 0
    },
    {
      "name": "YIELD1_BUFFERING_GAIN",
      "value": 0
    }
  ],
In the next file this array is just empty:
"markups": [ ]

Because of this I got this error message:
Error: The value being written to DT_TEXT or DT_NTEXT column is not a string or an array of bytes. bei Microsoft.SqlServer.Dts.Pipeline.PipelineBuffer.set_Item(Int32 columnIndex, Object value)
bei com.webkingsoft.JSONSource_Common.JSONSourceComponent.ProcessObject(JObject obj, PipelineBuffer inputbuffer)
bei com.webkingsoft.JSONSource_Common.JSONSourceComponent.ProcessInMemory(StreamReader sr, RootType rootType, PipelineBuffer inputbuffer, PipelineBuffer outputbuffer)

Is there a way how to handle this?
Coordinator
Mar 31 at 9:33 AM
Hi,

can you please provide some screenshots of the component settings so I can understand how are you trying to parse data?

Thank you.