Open timotheecour opened 3 years ago
refs https://forum.nim-lang.org/t/8074#51665
JSON.parse(json_str) already gets you a js object on which to operate, whereas in json or jsonutils you have an intermediate JsonNode representation:
JSON.parse(json_str)
parseJson(json_str).jsonTo(OptionChain)
what's missing is (in jsonutils):
proc fromJsonStr[T](a: var T, b: string) proc addJsonStr[T](result: var string, a: T)
from which you can derive outplace procs if needed (jsonStrTo, and toJsonStr)
this should have no overhead
there's a question on whether this should use streams, and JsonParser directly
JsonParser
see also parseJsonFragment
parseJsonFragment
refs https://forum.nim-lang.org/t/8074#51665
JSON.parse(json_str)
already gets you a js object on which to operate, whereas in json or jsonutils you have an intermediate JsonNode representation:parseJson(json_str).jsonTo(OptionChain)
what's missing is (in jsonutils):
from which you can derive outplace procs if needed (jsonStrTo, and toJsonStr)
this should have no overhead
note
there's a question on whether this should use streams, and
JsonParser
directlysee also
parseJsonFragment