This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// forked from: | |
// http://www.daveperrett.com/articles/2008/03/11/format-json-with-php/ | |
function indent($json) { | |
$result = ''; | |
$pos = 2; | |
$strLen = strlen($json); | |
$indentStr = ' '; | |
$newLine = "\n"; | |
$prevChar = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{"Period":"Jan","Demand Year 1":47413,"Demand Year 2":55220,"Demand Year 3":39875,"Demand Year 4":32180,"Demand Year 5":62377}, | |
{"Period":"Feb","Demand Year 1":56645,"Demand Year 2":57350,"Demand Year 3":64128,"Demand Year 4":38600,"Demand Year 5":66501}, | |
{"Period":"Mar","Demand Year 1":29881,"Demand Year 2":15445,"Demand Year 3":47653,"Demand Year 4":25020,"Demand Year 5":31404}, | |
{"Period":"Apr","Demand Year 1":39658,"Demand Year 2":27776,"Demand Year 3":36504,"Demand Year 4":51300,"Demand Year 5":36504}, | |
{"Period":"May","Demand Year 1":27361,"Demand Year 2":21408,"Demand Year 3":16888,"Demand Year 4":31790,"Demand Year 5":16888}, | |
{"Period":"Jun","Demand Year 1":19611,"Demand Year 2":17118,"Demand Year 3":17118,"Demand Year 4":32100,"Demand Year 5":18909}, | |
{"Period":"Jul","Demand Year 1":39639,"Demand Year 2":18028,"Demand Year 3":18028,"Demand Year 4":59832,"Demand Year 5":35500}, | |
{"Period":"Aug","Demand Year 1":37101,"Demand Year 2":19883,"Demand Year 3":19883,"Demand Year 4":30740,"Demand Year 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function csv_to_JSON($input, $delimiter, $request){ | |
$header = null; | |
$data = array(); | |
$csvData = str_getcsv($input, "\n"); | |
foreach($csvData as $csvLine){ | |
if(is_null($header)) $header = explode($att_delimiter, $csvLine); | |
else{ | |
$items = explode($att_delimiter, $csvLine); | |
for($n = 0, $m = count($header); $n < $m; $n++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Period,Year 1,Year 2,Year 3,Year 4,Year 5 | |
Jan,47413,55220,39875,32180,62377 | |
Feb,56645,57350,64128,38600,66501 | |
Mar,29881,15445,47653,25020,31404 | |
Apr,39658,27776,36504,51300,36504 | |
May,27361,21408,16888,31790,16888 | |
Jun,19611,17118,17118,32100,18909 | |
Jul,39639,18028,18028,59832,35500 | |
Aug,37101,19883,19883,30740,51250 | |
Sep,30036,15796,22105,47800,34443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* SyntaxHighlighter | |
* http://alexgorbatchev.com/ | |
* | |
* SyntaxHighlighter is donationware. If you are using it, please donate. | |
* http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate | |
* | |
* version | |
* 2.0.296 (March 01 2009) | |
* |
NewerOlder