To use the JSONTemplater with "sub-levels" you should make use of the Sub Templates in the transformer:
Here I've created the Root of the json document as:
With SUB_ROOT and SUB_SUB_ROOT templates defined in the Sub Templates section as:
and
respectively. The call in SUB_ROOT to bring in the SUB_SUB_ROOT template includes paramters to only include the sub-sub-features that are associated with the sub-feature. In this case both features have the same "sub_feat" value.
All you need to do is then send into the JSONTemplator features for each level, one for each Root, then all the sub-level and finally all the sub-sub-level features into their allocated input ports. Grouping of the subfeatures occurs when they carry the same feature identification attribute value as is present on the level above.
Running some sample data through the JSONTemplator and JSONFormatter (for PrettyPrint) we get:
I hope this help you to solve your json issue.