Cómo reformatear JSON en Notepad++?
Necesito Notepad++ para tomar una cadena json de este
{"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}}
A esto...
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
Miré a mi alrededor todas las opciones de TextFX pero no pude encontrar nada que funcionara.
15 answers
JSTool (anteriormente conocido como JSMin/JsMinNpp)
INSTALAR
Descárgalo desde http://sourceforge.net/projects/jsminnpp / y copia JSMinNpp.dll al directorio plugin de Notepad++. O simplemente puede instalar "JSTool" desde Plugin Manager en Notepad++.
Nueva instalación de Notepad++ y dónde fue PluginManager? Ver Cómo ver el Administrador de complementos en Notepad++
{
"menu" : {
"id" : "file",
"value" : "File",
"popup" : {
"menuitem" : [{
"value" : "New",
"onclick" : "CreateNewDoc()"
}, {
"value" : "Open",
"onclick" : "OpenDoc()"
}, {
"value" : "Close",
"onclick" : "CloseDoc()"
}
]
}
}
}
Consejo: Seleccione el código que desea reformatear, luego Plugins / JSTool / JSFormat.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-24 16:05:47
Universal Indent GUI plugin para Notepad++ convertirá su muestra en:
{
"menu" : {
"id" : "file", "value" : "File", "popup" : {
"menuitem" : [ {
"value" : "New", "onclick" : "CreateNewDoc()";
}
, {
"value" : "Open", "onclick" : "OpenDoc()";
}
, {
"value" : "Close", "onclick" : "CloseDoc()";
}
];
}
}
}
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-23 07:00:56
Yo personalmente uso JSON Viewer ya que el complemento Notepad++ ya no funciona.
EDIT-24 de mayo de 2012
Le aconsejo que descargue el complemento JSMin para el bloc de notas como se menciona en la respuesta . Esto funciona bien para mí en la última versión (v6. 1.2 en el momento de escribir).
EDIT - 7 de noviembre de 2017
Según el comentario de @danday74 a continuación, JSMin ahora es JSToolNpp. Además, tenga en cuenta que la herramienta Visor JSON está activada Codeplex que probablemente desaparecerá en un futuro próximo.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-01 12:02:19
El plugin JSMinNpp hará este trabajo. https://sourceforge.net/projects/jsminnpp /
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-11 03:35:10
No es una solución NPP, pero en un apuro, puede usar este formateador JSON en línea y luego pegar el texto formateado en NPP y luego seleccionar Javascript como idioma.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-23 18:18:35
El siguiente complemento Notepad++ funcionó para mí como sugirió " SUN" https://sourceforge.net/projects/jsminnpp /
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-19 23:06:54
Me funcionó en la última edición el Bloc de notas usando el UniversalIndentGui.
Lo que hice fue bajo la configuración del plugin elegir Habilitar Actualización automática de texto, apareció una ventana y seleccioné javascript.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-03-10 07:20:04
El bloc de notas 5.8.7 y jsmin 1.7.0.0 funcionan de maravilla aquí.
Tenga cuidado, sin embargo, descubrió que jsmin se come los comentarios de la manera difícil (debería haber leído primero).
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-03-30 21:43:31
Estoy usando el complemento JSON Viewer con NPP 5.9 y parece que funciona bien.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-03-23 03:42:19
Sé que este hilo es viejo, pero recientemente me encontré con un problema con JSToolNPP no es compatible con mi N++ recién actualizado, encontré un reemplazo que parece funcionar. http://sourceforge.net/projects/nppjsonviewer /
Use bajo su propio riesgo, ofc. (descargo de responsabilidad estándar de mí al vincular cualquier cosa fuera del SExchange, para su información)
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-21 03:18:03
Necesita el plugin para formatear JSON.To instalar plugin hacer siguiente paso
- Open notepad++ - > ALT + P - > Plugin Manager - > Selcet JSON Viewer - > Click Instalar
- Reiniciar el bloc de notas++
- Ahora puede usar el acceso directo para formatear json como CTRL + ALT + SHIFT + M o ALT + P - > Plugin Manager - > JSON Viewer - > Format JSON
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-17 11:07:44
Si no desea instalar un complemento Notepad++ pero tiene Firefox y un complemento JSON para Firefox, puede seleccionar Run -> Launch in Firefox
. Usted obtiene el contenido formateado como JSON usando su plugin de Firefox.
Esto es lo que hago personalmente.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-08-27 11:07:51
Puedes usar http://www.jsonlint.com / para editar su json
en línea si no tiene Bloc de notas++.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-10-26 20:07:54
Sé que preguntaste sobre NotePad++ pero TextMate para OS X puede hacerlo a través del paquete JSON, se llama el comando "Reformatear documento".
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-11-20 01:03:24
Lo mejor es usar una de las últimas versiones de Eclipse (estoy usando Eclipse Galileo J2EE y Eclipse Ganymede J2EE). Cree un archivo JavaScript, luego cree una variable:
var jsonObject = {"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}};
Por último, pulsa CTRL+CAMBIO+F y voila! Tienes un objeto JSON muy bien sangrado. Yo, también, estoy buscando un formateador de Notepad++ JSON, y muy bien puede ser forzado a desarrollar un plugin Npp en poco tiempo en el futuro.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-08-24 03:59:07