better structure for json serializer