<?php
/* read a JSON file in a nice format
{"doc":[
{"dir":"m2024_02","fn":"mission_120.pdf",
"updated":"2023_12_27 10:02:45","size":"234","uid":"3420"},
{"dir":"p2024_02", "fn":"perfrom_210.zip",
"updated":"2023_12_27 10:02:46","size":"235","uid":"3420"}
]
}
*/
$formdata = file_get_contents($fn);
//Remove the end of lines
$formdata = trim(preg_replace('/\s+/', ' ', $formdata));
?>
// JavaScript will work now
<script>
let formdata = <?php echo $formdata ?>; // no quotations are required as it is JSON
</script>