Add include_all_values option for stream JSON parser to emit the whole value after parsing an array/map. Defaults to false to skip collecting the intermediate values in parsing.
For the following case with option include_all_values=True:
from taskweaver.utils.json_parser import parse_json_stream
import json
for ev in parse_json_stream(json.dumps({
"str_val": "hello world",
"int_val": 42,
"float_val": 3.14,
"bool_val": True,
"null_val": None,
"list_val": [1, 2, 3],
"dict_val": {"a": 1, "b": 2, "c": 3},
"nested_val": {
"a": 1,
"b": 2,
"c": {
"x": 10,
"y": 20,
"z": 30
}
}
}), include_all_values=True, skip_ws=True):
if not ev.is_end:
continue
if ev.value is None:
continue
print(ev)
Add
include_all_values
option for stream JSON parser to emit the whole value after parsing an array/map. Defaults to false to skip collecting the intermediate values in parsing.For the following case with option
include_all_values=True
:The output would be like below: