There is a JSON file of this structure:

{ "person" { "someElement" : "test", "operationsList": [ { "date": 1505980686916, "sendersLastName": "last", "sendersFirstName": "first", "sendersSecondName": "second", "operationDetailsList" : [ { "innerKey" : "key1", "innerValue" : "value1" }, { "innerKey" : "key2", "innerValue" : "value2" } ], "operationCurrencyAmount": 456, "operationCurrencyCode": "TEST" }, { "date": 1505980686916, "sendersLastName": "last", "sendersFirstName": "first", "sendersSecondName": "second", "operationDetailsList" : [ { "innerKey" : "key1", "innerValue" : "value1" }, { "innerKey" : "key2", "innerValue" : "value2" } ], "operationCurrencyAmount": 456, "operationCurrencyCode": "TEST" }, ], "otherField" : "testValue" }, "booleanFlag" : true } 

Created jr: list with "operationsList" elements: subDataSource ("person.operationsList") .

Inside this (operationsList) sheet, there is another jr: list (operationDetailsList): subDataSource ("operationDetailsList")

Question: It is necessary inside the child (operationDetailsList) sheet to use the root element "booleanFlag" as the printWhenExpression for one of the fields (for example, "innerKey"). However, in the list of available fields there are only fields from subDataset = "operationDetailsList", i.e. only "innerKey" and "innerValue" are available. Can I access the "booleanFlag" element from a leaf in a leaf?

  • First you need to parse json, and then access its elements. - Roman C
  • As an option, to make an additional object with a parameter in the form of this flag and, at the end of the parse JSON string, embed this object into the map map <JsonObject, SomeFlagObject>. Or it’s much easier to do map <JsonObject, List <Object >> - GenCloud

1 answer 1

There is a solution; you can pass this field as a parameter to a sheet and use the parameter in the sheet, and not the field itself.