forked from tulios/json-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
39 lines (31 loc) · 846 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var unwrapQuotedJsonInPlace = require('../extension/src/json-viewer/unwrapQuotedJson.js');
var util = require('util');
var sQuotedJson = JSON.stringify({test: 2, test2: "3"});
var sQuotedJsonArray = JSON.stringify([{ test: 2, test2: 3 }, { test: 3, test2: 4 }]);
var objInner = {
InnerTest: 21,
InnerTest2: 12,
// BrokenJson: "{\" but not json",
InnerString: "String",
InnerJson: sQuotedJson
};
var obj = {
"Test": 1,
"Test2": 2,
"Wrapped": "foo",
SubObject: objInner,
SubArray: sQuotedJsonArray
};
console.log("Before: " +
util.inspect(obj, {
depth: null,
colors: true
}));
var results = { fFoundJson: false};
obj = unwrapQuotedJsonInPlace(obj, results);
console.log("return: " + results.fFoundJson);
console.log("After: " +
util.inspect(obj, {
depth: null,
colors: true
}));