Writing dictionary to file

What’s the best way to write a xojo.core dictionary (jsondata) to a file

Previously using jsonitems i used
dim cfgOptions as new JSONItem
cfgOptions.Value(“options”)=cfg
cfg.Compact=True
Dim tos2 as TextOutputstream = TextOutputStream.Create(g)
tos2.Write cfgOptions.tostring
tos2.Close

dim json as text = Xojo.Data.GenerateJSON( dict )

http://developer.xojo.com/xojo-data