File:  [parser3project] / parser3 / tests / 253.html
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Aug 31 21:51:56 2010 UTC (16 years ago) by moko
Branches: MAIN
CVS tags: HEAD
json test added

@main[]

$f[^file::load[text;253_json.txt]]

$o[^json:parse[^taint[as-is][$f.text]][ $.double(false) ]]
^print[$o]

$o[^json:parse[^taint[as-is][$f.text]][ $.object[$hook] ]]
^print[$o]

@print[hash]
^hash.foreach[k;v]{
   $k = ^if($v is 'hash'){{^print[$v] 
   }}{
     $v.CLASS_NAME ^if($v is 'bool'){ ^if($v){true}{false} }($v is 'class1' || $v is 'class2'){^v.print[]}{$v}
   }
}

@hook[key;value]
$result[^if(def $value.type){^reflection:create[$value.type;create;$value]}{$value}]

@CLASS
class1

@create[h]
$value[$h.value]

@print[]
value "$value"

@CLASS
class2

@create[h]
$value[$h.value]

@print[]
value "$value"

E-mail: