|
|
| version 1.1, 2010/08/31 21:51:56 | version 1.8, 2017/02/09 19:54:38 |
|---|---|
| Line 1 | Line 1 |
| @main[] | @main[] |
| $f[^file::load[text;253_json.txt]] | $f[^file::load[text;253_json.txt; $.charset[windows-1251]]] |
| $s[^taint[as-is][$f.text]] | |
| $o[^json:parse[^taint[as-is][$f.text]][ $.double(false) ]] | ^try-catch{$o[^json:parse[$s]]} |
| $o[^json:parse[$s][ $.object[$hook] $.distinct[first] ]] | |
| ^print[$o] | |
| $o[^json:parse[$s][ $.double(false) $.distinct[last] ]] | |
| ^print[$o] | ^print[$o] |
| $o[^json:parse[^taint[as-is][$f.text]][ $.object[$hook] ]] | $o[^json:parse[$s][ $.int(false) $.distinct[last] ]] |
| ^print[$o] | |
| $o[^json:parse[$s][ $.object[$hook_key] $.distinct[all] ]] | |
| ^print[$o] | |
| $s[[1,{"type":"class1","value":"3"},4]] | |
| $o[^json:parse[$s][ $.object[$hook] ]] | |
| ^print[$o] | |
| $o[^json:parse[$s]] | |
| ^print[$o] | ^print[$o] |
| @print[hash] | @print[hash] |
| ^hash.foreach[k;v]{ | $result[^json:string[$hash; $.indent(1)]] |
| $k = ^if($v is 'hash'){{^print[$v] | $result[^result.replace[e+0;e+]] |
| }}{ | |
| $v.CLASS_NAME ^if($v is 'bool'){ ^if($v){true}{false} }($v is 'class1' || $v is 'class2'){^v.print[]}{$v} | |
| } | |
| } | |
| @hook[key;value] | @hook[key;value] |
| $result[^if(def $value.type){^reflection:create[$value.type;create;$value]}{$value}] | $result[^if(def $value.type){^reflection:create[$value.type;create;$value]}{$value}] |
| @hook_key[key;value] | |
| $result[^if($key eq 'object'){^reflection:create[$value.type;create;$value]}{$value}] | |
| @CLASS | @CLASS |
| class1 | class1 |
| @create[h] | @create[h] |
| $value[$h.value] | $value[class1 $h.value] |
| @print[] | |
| value "$value" | |
| @CLASS | @CLASS |
| class2 | class2 |
| @create[h] | @create[h] |
| $value[$h.value] | $value[class2 $h.value] |
| @print[] | |
| value "$value" |