Improve export to JSON