How to get historical data in json format


  • I want to create 50 ma so I try to fetch historical data but data not in json format. Please guide to change this data in json format in php.
    i want define
    $resJsonArray = json_decode($result, true);
    $close = $resJsonArray['close']; or $close = $resJsonArray['data'['1'];
    echo " close " . $close;
    Historical data output :
    2021-03-31T09:15:00+05:30,360.30,360.30,357.95,358.80,467553\n2021-03-31T09:16:00+05:30,359.00,359.60,358.45,359.55,293184\n2021-03-31T09:17:00+05:30,359.45,361.10,359.40,360.90,479857\n2021-03-31T09:18:00+05:30,360.80,361.70,360.60,361.45,274692\n2021-03-31T09:19:00+05:30,361.45,361.60,361.00,361.40,169441\n2021-03-31T09:20:00+05:30,361.40,361.40,360.80,361.40,162105\n2021-03-31T09:21:00+05:30,361.30,361.45,360.90,360.95,98352\n2021-03-31T09:22:00+05:30,361.00,361.00,360.50,360.95,133202\n2021-03-31T09:23:00+05:30,361.05,362.00,360.85,361.70,280737\n2021-03-31T09:24:00+05:30,361.85,361.95,361.35,361.70,89110\n2021-03-31T09:25:00+05:30,361.80,362.00,361.55,361.75,148871\n2021-03-31T09:26:00+05:30,361.85,361.85,361.25,361.40,86010\n2021-03-31T09:27:00+05:30,361.40,361.50,361.20,361.25,60152\n2021-03-31T09:28:00+05:30,361.25,361.35,360.20,360.20,266024\n2021-03-31T09:29:00+05:30,360.15,360.30,359.80,359.95,201918\n2021-03-31T09:30:00+05:30,360.00,360.50,359.95,360.50,87527


  • Hi @aksharmty we have change the historical data format.


  • How to convert historical data in json format in php