This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new 98dfd826ae Issue #2569 : Describe the nested Enhanced JSON Output 
sample (#9202)
98dfd826ae is described below

commit 98dfd826ae360fa836cd0afcaf1c4aeb62864b4f
Author: Matt Casters <[email protected]>
AuthorDate: Mon Nov 2 15:45:28 2026 +0100

    Issue #2569 : Describe the nested Enhanced JSON Output sample (#9202)
    
    * Issue #2569 : Describe the nested Enhanced JSON Output sample
    
    The manual named the sample and did not say how the two transforms
    build the document, or that a fields-only transform writes one array.
    
    * Issue #2569 : Correct the nested JSON sample notes
    
    The group key is field1, and Sort rows orders field1 descending then field2 
ascending.
    The notes name the exceptions for a transform with no group key and show 
the sample output.
---
 .../pipeline/transforms/enhancedjsonoutput.adoc    | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git 
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/enhancedjsonoutput.adoc
 
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/enhancedjsonoutput.adoc
index 80a1110739..bd58cd11ba 100644
--- 
a/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/enhancedjsonoutput.adoc
+++ 
b/docs/hop-user-manual/modules/ROOT/pages/pipeline/transforms/enhancedjsonoutput.adoc
@@ -152,4 +152,24 @@ You can use this option (and a chain of transforms, see 
the example pipeline in
 
 == Notes
 
-Look at the sample provided _json-output-generate-nested-structure.hpl_ for a 
better understanding about how the transform works
+The sample `json-output-generate-nested-structure.hpl` builds a nested 
document with two Enhanced JSON Output transforms.
+Sort rows orders the input by `field1` descending, then `field2` ascending, so 
the `C` group comes first.
+The first transform groups by `field1` and writes `field2` and `field3` as 
`campo2` and `campo3` into the field `lvl1Details`.
+The second transform has no group key.
+It writes `field1` as `campo1` and embeds `lvl1Details` as `details`, under 
the block name `results`.
+
+With no group key and Force single grouped item unchecked, the output is an 
array with one object per row.
+A single row gives one object unless Force arrays in JSON is checked.
+With Force single grouped item and no group key, every row counts as the same 
group, so the rows merge into one object with an array per field.
+A JSON block name wraps that value in an object.
+The sample's second transform does this with `results`.
+Grouped items require a group key, and the input has to be sorted by every 
group key.
+The Group Key section above shows that file shape.
+
+The sample writes this value.
+`campo3` is a string because the Data Grid defines `field3` as String.
+
+[source,json]
+----
+{"results":[{"campo1":"C","details":[{"campo2":"B","campo3":"7"},{"campo2":"F","campo3":"5"},{"campo2":"F","campo3":"6"},{"campo2":"V","campo3":"6"}]},{"campo1":"B","details":[{"campo2":"C","campo3":"1"},{"campo2":"C","campo3":"2"},{"campo2":"D","campo3":"4"}]},{"campo1":"A","details":[{"campo2":"B","campo3":"1"},{"campo2":"B","campo3":"2"}]}]}
+----

Reply via email to