UNPKG

jsoneditor

Version:

A web-based tool to view, edit, format, and validate JSON

57 lines (51 loc) 1.19 kB
<!DOCTYPE HTML> <html lang="en"> <head> <meta charset="utf-8"> <title>JSONEditor | Translate</title> <link href="../dist/jsoneditor.css" rel="stylesheet" type="text/css"> <script src="../dist/jsoneditor.js"></script> <style type="text/css"> #jsoneditor { width: 500px; height: 500px; } </style> </head> <body> <p> JSONEditor has support for multiple languages (i18n), in this case uses <code>pt-BR</code>. </p> <div id="jsoneditor"></div> <script> // create the editor const container = document.getElementById('jsoneditor') const options = { // switch between pt-BR or en for testing forcing a language // leave blank to get language 'language': 'pt-BR', 'languages': { 'pt-BR': { 'auto': 'Automático testing' }, 'en': { 'auto': 'Auto testing' }, 'newlang': { 'auto': 'Auto new lang' } } } const editor = new JSONEditor(container, options) const json = { 'array': [1, 2, 3], 'boolean': true, 'null': null, 'number': 123, 'object': { 'a': 'b', 'c': 'd' }, 'string': 'Hello World' } editor.set(json) </script> </body> </html>