backport master fixes to json exporter