Highlights a JSON or JavaScript string with colors
The string to highlight (JSON or JavaScript literal)
Optional
Optional configuration for highlighting
The highlighted string with ANSI color codes
const json = '{"name": "John", "age": 30}';const highlighted = highlight_string(json);console.log(highlighted); // Outputs colorized representation Copy
const json = '{"name": "John", "age": 30}';const highlighted = highlight_string(json);console.log(highlighted); // Outputs colorized representation
const arr = '[1, 2, 3, "hello", true]';const highlighted = highlight_string(arr, { palette: boldPalette });console.log(highlighted); Copy
const arr = '[1, 2, 3, "hello", true]';const highlighted = highlight_string(arr, { palette: boldPalette });console.log(highlighted);
Highlights a JSON or JavaScript string with colors