You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hop.apache.org by "pmenga52 (via GitHub)" <gi...@apache.org> on 2025/10/06 03:53:06 UTC

[I] [Bug]: JSON input & "Default path leaf to null" flag (hop)

pmenga52 opened a new issue, #5781:
URL: https://github.com/apache/hop/issues/5781

   ### Apache Hop version?
   
   2.16
   
   ### Java version?
   
   21.0.8
   
   ### Operating system
   
   Linux
   
   ### What happened?
   
   In a JSON input transform, the Content/_Default path leaf to null_ is set to On, for json files that contains null array value
   
   1. Inputs
   
   Here are 2 json files
   
   - (file1 = all values are set)
   - (file2 =  the third leaf has an empty sub value SubLeaf - "SubLeaf": [])
   
   [file1.json](https://github.com/user-attachments/files/22714369/file1.json)
   
   [file2.json](https://github.com/user-attachments/files/22714371/file2.json)
   
   the pipelines file1.hpl and file2.hpl consists of a single JSON input transform with file1.json or file2.json as an input.
   Here are the two files (renamed in*.txt for the github repository):
   
   [file1.hpl.txt](https://github.com/user-attachments/files/22714388/file1.hpl.txt)
   
   [file2.hpl.txt](https://github.com/user-attachments/files/22714390/file2.hpl.txt)
   
   
   and at last, each "Fields" settings consists of two identical json paths (written with the help of "Select fields" button):
   
   Name	Path	
   Leaf	$.value.*.Leaf
   SubLeaf	$.value.*.SubLeaf.*.SubLeaf
   
   <img width="577" height="192" alt="Image" src="https://github.com/user-attachments/assets/06616f1e-6dc6-40f0-8d1f-180caa55dc83" />
   
   2. output
   
   with file2.hpl, I still have the following error:
   _The data structure is not the same inside the resource! We found 2 values for json path [$.value.*.SubLeaf.*.SubLeaf], which is different that the number returned for path [$.value.*.Leaf] (3 values). We MUST have the same number of values for all paths._
   
   which, I suppose should not occur, for I checked the **Default path leaf to null** flag
   
   -  is the json path for fields incorrect? ($.value.*.SubLeaf.*.SubLeaf dealing with null arrays like "SubLeaf": [])
   - is the **Default path leaf to null**  working or not?
   
   I'm struggling with standard json outputs from odata v4 requests  (null array leaves as a result to null values)
   
   Pierre
   
   ### Issue Priority
   
   Priority: 3
   
   ### Issue Component
   
   Component: Transforms


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: JSON input & "Default path leaf to null" flag (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva commented on issue #5781:
URL: https://github.com/apache/hop/issues/5781#issuecomment-3384770839

   I'm afraid to tell you it works as expected and you will have to tackle this differently.
   The best way to work around this is to use following selector for your subleaf `[{"SubLeaf":"SubLeaf-Two"}]` and then parse the content further in a next json input.
   The option to return null on default leaf only works on the same root level.
   For example disabling that option will make this structure fail:
   ```
   {
     "value": [
       {
         "Leaf": "Leaf-One",
         "SubLeaf": [{ "SubLeaf": "SubLeaf-One" }]
       },
       {
         "Leaf": "Leaf-Two",
         "SubLeaf": [{ "SubLeaf": "SubLeaf-Two" }]
       },
       {
         "Leaf": "Leaf-Three"
       }
     ]
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: JSON input & "Default path leaf to null" flag (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva closed issue #5781: [Bug]: JSON input & "Default path leaf to null" flag
URL: https://github.com/apache/hop/issues/5781


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: JSON input & "Default path leaf to null" flag (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva commented on issue #5781:
URL: https://github.com/apache/hop/issues/5781#issuecomment-3370590086

   Thanks for the good sample and reproduction path. 
   Would have to check in the code what happens here


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: JSON input & "Default path leaf to null" flag (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva commented on issue #5781:
URL: https://github.com/apache/hop/issues/5781#issuecomment-3384609677

   .take-issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: JSON input & "Default path leaf to null" flag (hop)

Posted by "pmenga52 (via GitHub)" <gi...@apache.org>.
pmenga52 commented on issue #5781:
URL: https://github.com/apache/hop/issues/5781#issuecomment-3379477572

   HI hansva,
   realy waiting for news from you, for I'm on a production project that  massively uses Json input transform 
   and because of this behavior, the only workaround I found is to create as many sub-requests as null subleaves that exist., which weigh down the bill.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org