Open
Description
Since #667 JsonWriter#jsonValue()
allows emitting a raw json blob when generating json.
I'd like the equivalent for parsing json. In my case, I have large/complex json sub-trees that I would like to avoid parsing to save cpu/allocations. But I still need the value so I can re-create the original json if needed.
Currently I use a typeadapter as so:
class RawJsonAdapter: TypeAdapter<String>() {
override fun write(out: JsonWriter?, value: String?) {
out?.jsonValue(value)
}
override fun read(reader: JsonReader?): String {
return JsonParser().parse(reader).toString()
}
}
However the entire subtree has to be first parsed, and then re-serialized to json before I end up with the raw value.
Is there a more performant way to implement my TypeAdapter#read
here?