Uploaded image for project: 'Pentaho Data Integration - Kettle'
  1. Pentaho Data Integration - Kettle
  2. PDI-19138

JSON input: Step does not return record when trying to retrieve a field with NULL value.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Severity: Urgent
    • Resolution: Fixed
    • Affects Version/s: 8.3.0 GA, 9.0.0 GA, 9.1.0 GA, 9.1.0.4 GA
    • Fix Version/s: Backlog
    • Component/s: Step
    • Labels:
      None
    • Story Points:
      5
    • PDI Sub-component:
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.
    • Sprint Team:
      Mos Eisley
    • Steps to Reproduce:
      Hide
      Show
      Use the attached sample to replicate the issue. JSON_example.zip

      Description

      When trying to retrieve a field using the JSON Path, if the field contains a null record then the output will not be shown.

      For example:

      {
      	"id": "123456",
      	"testArray": [
      		{
      			"id": "1654879",
      			"Name": null,
      			"testArray_inner_one": [
      				{
      					"id": "15697",
      					"Name": "Robert"
      				}
      			]
      		},
      		{
      			"id": "888",
      			"Name": "Robert222",
      			"testArray_inner_two": [
      				{
      					"id": "4309",
      					"Name": null
      				}
      			]
      		}
      	]
      }
      

      Here we are trying to get the Name field under testArray. We get the output as

      id;ResourceName
      123456;Robert222
      

      Instead of showing the result as

      id;ResourceName
      123456;
      123456;Robert222
      

      The zip file with the sample transformation also contains the output generated. JSON_example.zip

      We get the expected result when we retrieve both id and Name in the array. Refer to the screenshot

      I checked the expression as $.testArray.[*].Name in https://jsonpath.herokuapp.com/ and it is showing the expected result. Refer to the screenshot below

      Using the same expression in the transformation still results in one record and the null record is not shown.

        Attachments

          Activity

            People

            Assignee:
            vshalkova Viktoryia Shalkova
            Reporter:
            gdev Gurudev
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: