File:  [parser3project] / parser3 / tests / 253.html
Revision 1.7: download - view: text, annotated - select for diffs - revision graph
Sun May 4 01:45:43 2014 UTC (12 years, 4 months ago) by misha
Branches: MAIN
CVS tags: release_3_4_4, HEAD
- test for ^json:parse[$.int(false)] is added

@main[]

$f[^file::load[text;253_json.txt; $.charset[windows-1251]]]
$s[^taint[as-is][$f.text]]

^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]

$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[hash]
^json:string[$hash; $.indent(1)]

@hook[key;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
class1

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

@CLASS
class2

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

E-mail: