Use brtr_foreach() in brtr_export_json() for both arrays and objects.