Hermosa representación JSON en Pure JavaScript-JSON Formatter
| Autor: | mohsen1 |
|---|---|
| Views Total: | 5,211 |
| Sitio oficial: | Ir a la web |
| Actualizado: | September 20, 2018 |
| Licencia: | MIT |
Vista prévia
Descripción
JSON Formatter es un plugin de JavaScript puro que se utiliza para desgarrador objetos JSON locales y/o archivos JSON externos de una manera elegante (al igual que la estructura de árbol plegable).
Funcionamiento
Instale JSON Formatter a través de NPM.
npm install --save json-formatter-js
O incluir directamente el código JavaScript en su documento HTML.
<script src="dist/json-formatter.js"></script>
Cree un nuevo objeto JSONFormatter con los siguientes parámetros:
- JSON: objeto JSON o array
- abrir: indica cuántos niveles debe expandir el árbol representado
- config: opciones de configuración
JSONFormatter(json, open, config)
Todas las opciones de configuración predeterminadas.
{
hoverPreviewEnabled: false,
hoverPreviewArrayCount: 100,
hoverPreviewFieldCount: 5,
animateOpen: true,
animateClose: true,
theme: null, // or 'dark'
useToJSON: true // use the toJSON method to render an object as a string as available
}; Abra una profundidad específica.
const formatter = new Formatter(); formatter.openAtDepth(1);
Registro de cambios
v2.2.1 (09/20/2018)
- Bugfix & añadir más opciones





