File:  [parser3project] / parser3 / tests / 253.html
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Fri Sep 24 22:56:35 2010 UTC (15 years, 11 months ago) by moko
Branches: MAIN
CVS tags: HEAD
charset transcode test added for json:parse

@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][ $.distinct[first] ]]
^print[$o]

$o[^json:parse[$s][ $.double(false) $.distinct[last] ]]
^print[$o]

$o[^json:parse[$s][ $.object[$hook] $.distinct[all] ]]
^print[$o]

@try_catch[code]
^try{
	$code
}{
	$exception.handled(true)
	$exception.source
	$exception.comment
}

@print[hash]
^json:string[$hash; $.indent(1)]

@hook[key;value]
$result[^if(def $value.type){^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: