-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
57 lines (48 loc) · 862 Bytes
/
test.html
File metadata and controls
57 lines (48 loc) · 862 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="./jsonx.min.js"></script>
</head>
<body>
<h2>See the console ~</h2>
<script type="text/javascript">
const samples = [
`null`,
`1e3`,
`'1e3'`,
`"String"`,
`[1,2,3,{a:1}]`,
`callback([1, {
'
123456 ':1234,
1234567:'JSONP here',
"12345678":"1123456",
},null]);
`,
`{ 'a': 'abc' }`,
`{ aaaaa : 'abc' }`,
`{ 555 : 666 }`,
`{
aaa:[
1,
2,
3,
'4'
}`
];
const test = (s) => {
try {
let v = jsonx.parse(s);
let t = Object.prototype.toString.call(v);
let j = JSON.stringify(v);
console.log({ s, v, t, j });
} catch(error){
console.log({ s, error: error })
}
}
samples.forEach(s => test(s));
console.log('\n### TEST END ###\n')
</script>
</body>
</html>