How to convert an array to JSON in TypeScript

1 Answer

0 votes
const arr = ["typescript", "php", "c++", "python"];

const json = JSON.stringify(arr);

console.log(json);
  
  
  
  
/*
run:
  
"["typescript","php","c++","python"]" 
  
*/

 



answered May 22, 2022 by avibootz
...