Saturday, 15 February 2014

Is there a pull-style JSON StreamReader parser for .NET? -



Is there a pull-style JSON StreamReader parser for .NET? -

i need deserialize json streamreader, without instantiating intermediate objects every object in stream.

json.net invoked jsonconvert.deserializeobject<t>(string json, jsonconverter[] converters) doesn't take streamreader, , creates in memory whole set of newtonsoft.json.* classes json structore, memory profiler shows. _i'm not sure case, because jsonconverters _ javascriptserializer doesn't seem back upwards streams @ all. and undocummented new jsonserializer().deserialize(new jsontextreader(streamreader))

what want in 0 approach sax or stax-style json parser.

what want ideally, api like

object jsoncooler.deserializeobject<t>( streamreader jsonstream, converter[] converters)

which deserialize straight new instance of class t, not keeping of intermediate dom-like objects in memory.

does such deserializer exist? or missing @ concept level?

i suspect it's utilize case becoming more , more frequent. considering back upwards time via little 1 strive maintain short , fast:

https://github.com/ysharplanguage/fastjsonparser

i'm still busy making stable first, if want give seek @ implementing in fork before chance, that'd plenty amend obj(int outer) , arr(int outer) methods, along adding (optional) "reviver" callback delegate typeinfo cache. 1 allow application decide whether/when next object "{ ... }" or array "[ ... ]" in stream needs content deserialized or not.

'hth,

.net json parsing json.net xmlpullparser

No comments:

Post a Comment