mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
Added JSONFormatter interface and tests
This commit is contained in:
@@ -16,4 +16,20 @@ var json:JSON = {
|
||||
editor.set(json);
|
||||
editor.expandAll();
|
||||
|
||||
var json2:JSON = editor.get(json);
|
||||
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);
|
||||
5
jsoneditoronline/jsoneditoronline.d.ts
vendored
5
jsoneditoronline/jsoneditoronline.d.ts
vendored
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user