-
I have a large JSON file (a performance profile trace generated by Chrome's devtools) that I am using strema-json to parse. After I have done some changes to it, I am saving it back to the disk using:
The above is working fine, but I noticed it outputs the whole JSON to the first line of the file. Such as: {"traceEvents": [{"args": {}, ...otherProps },{"args": {}, ...otherProps },{"args": {}, ...otherProps }]} I wanted to know if it is possible to change this, so it could input every object inside the {"traceEvents": [
{"args": {}, ...otherProps },
{"args": {}, ...otherProps },
{"args": {}, ...otherProps }
]} Is this possible to do using this library? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
There is no component that can produce human-readable output. It should be easy to add one. At some point, I thought about one but couldn't decide on a format or supported formatting features. For example, you keep array elements on separate lines together, but how to treat arrays in arrays? Remember that we should provide a generic solution suitable for data of different shapes. There is one component that does something like that — the JSONL stringer: jsonl/Stringer. It should be possible to build something up using code from both stringers. In general, the JSON formatting was a moot point for me because I worked with files I could not open in any non-streaming editor nor I could conceivably look at due to their sheer size. |
Beta Was this translation helpful? Give feedback.
There is no component that can produce human-readable output. It should be easy to add one. At some point, I thought about one but couldn't decide on a format or supported formatting features. For example, you keep array elements on separate lines together, but how to treat arrays in arrays? Remember that we should provide a generic solution suitable for data of different shapes.
There is one component that does something like that — the JSONL stringer: jsonl/Stringer. It should be possible to build something up using code from both stringers.
In general, the JSON formatting was a moot point for me because I worked with files I could not open in any non-streaming editor nor I could concei…