ConceptPortal-public/rsconcept/frontend/src/components/View/PrettyJSON.tsx

12 lines
254 B
TypeScript
Raw Normal View History

2023-07-15 17:46:19 +03:00
interface PrettyJsonProps {
2023-12-28 14:04:44 +03:00
data: unknown;
2023-07-15 17:46:19 +03:00
}
/**
* Displays JSON data in a formatted string.
*/
2025-02-07 10:54:47 +03:00
export function PrettyJson({ data }: PrettyJsonProps) {
const text = JSON.stringify(data, null, 2);
return <pre>{text === '{}' ? '' : text}</pre>;
2023-07-15 17:46:19 +03:00
}