File: json_test.js

package info (click to toggle)
freej 0.10git20100110-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 32,080 kB
  • ctags: 22,705
  • sloc: cpp: 156,254; ansic: 25,531; sh: 13,538; perl: 4,624; makefile: 3,278; python: 2,889; objc: 1,284; asm: 1,125; ruby: 126
file content (22 lines) | stat: -rw-r--r-- 403 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
include("../lib/json2.js");

echo("JSON library included");

files = scandir(".");

echo("files found: " + files.length);

// stringify the array
json_enc = JSON.stringify(files);

echo("json size: " + json_enc.length );

// and parse it back
json_dec = JSON.parse(json_enc);

// then go through the array and load the scripts we like
var c;
for(c=0; c<json_dec.length; c++) {
    echo(json_dec[c]);
}