<?php

class JsonAdapter {


# ~ Export data to JSON file format- - - - - - - - - - - - - - - - - - - - - - #
	public function export($records, $columns, $filename = null) {

		# Get filename
		$filename = date('Y.m.d H:i') . '-' . $filename . '.json';

		# Set headers
		header('Content-Type: application/json');
		header('Content-Disposition: attachment; filename="' . $filename .'"');

		# Echo json
		echo json_encode($records);

		exit;
	}

}
