diff --git a/jsoneditoronline/jsoneditoronline-tests.ts b/jsoneditoronline/jsoneditoronline-tests.ts index ca5d614de..ea97d9f44 100644 --- a/jsoneditoronline/jsoneditoronline-tests.ts +++ b/jsoneditoronline/jsoneditoronline-tests.ts @@ -16,4 +16,20 @@ var json:JSON = { editor.set(json); editor.expandAll(); -var json2:JSON = editor.get(json); \ No newline at end of file +var jsonResult:JSON = editor.get(json); + +var options2: JSONformatterOptions = { + "indentation": 2 +}; +var formatter:JSONFormatter = new JSONFormatter(container, options); +var json2:JSON = { + "Array": [1, 2, 3], + "Boolean": true, + "Null": null, + "Number": 123, + "Object": {"a": "b", "c": "d"}, + "String": "Hello World" +}; +formatter.set(json2); + +var jsonResult2:JSON = formatter.get(json2); \ No newline at end of file diff --git a/jsoneditoronline/jsoneditoronline.d.ts b/jsoneditoronline/jsoneditoronline.d.ts index 1fffc1afb..0a69fd0f8 100644 --- a/jsoneditoronline/jsoneditoronline.d.ts +++ b/jsoneditoronline/jsoneditoronline.d.ts @@ -29,4 +29,9 @@ interface JSONFormatterOptions { interface JSONFormatter { (container:HTMLElement, options?: JSONFormatterOptions, json?: JSON): JSONEditor; + (container:HTMLElement, options?: JSONFormatterOptions, json?: string): JSONEditor; + set(json: JSON); + get(): JSON; + setText(jsonString: string); + getText(): string; } \ No newline at end of file