JSON export and publishing

There is a difference in the naming of columns between the JSON publishing and the CSV export in Aggregate. This can be seen for fields in a group.

If I have a group called "group1" and a field in this group called "field1" in the CSV export it shows as group1:field1, in the JSON publishing I only get field1. This difference can also be seen if you just export JSON instead of publishing it.

After trying to understand what is going on in the code I am guessing that the difference comes from in the csv export column.getDisplayHeader() is used, while for the JSON exported element.getElementName() is used. Is there any reason for this difference? Reading the documentation it says the the JSON publishing should preserve groups. So what I actually expected was a nested JSON like this: ( {"group1": {"field1": ..}}).

For our project it is quite important that this JSON publishing works in a consistent way with other ways of exporting the data. Someone from our team might be able to take a look at changing this code and filing a pull request, but it would take some time since non of us have any experience with the Aggregate code. It also depends on if this is a sensible change in the first place.

I think it is a totally sensible change, but if implemented would probably have to be an option in case people have written code that depends on the current behaviour.

I agree with your reading of the documentation that nested JSON should be expected for groups.

2 Likes