You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The entire file is read into a a single item, a json list (instead of providing a stream of each item in the list).
It also throws this error, but seems to recover from it:
22:58:34.586 [zio-default-blocking-2] DEBUG zio.json.JsonDecoderPlatformSpecific -- timestamp=2024-02-22T22:58:34.583386+01:00 level=DEBUG thread=zio-fiber-7 message="Fiber zio-fiber-7 did not handle an error" cause=
zio.json.internal.UnexpectedEnd: if you see this a dev made a mistake using OneCharReader
When trying this to read the file as a Stream[Competition]
Ok so this was a weird one. I was running all the code inside one file, in a Main.scala file.
The stackoverflow error dissapears if I define the Competition class and decoder outside of the main object.
Only this remains, but the result seems to be fine:
20:10:09.146 [zio-default-blocking-2] DEBUG zio.json.JsonDecoderPlatformSpecific -- timestamp=2024-02-23T20:10:09.144538+01:00 level=DEBUG thread=zio-fiber-7 message="Fiber zio-fiber-7 did not handle an error" cause=
zio.json.internal.UnexpectedEnd: if you see this a dev made a mistake using OneCharReader
@SimunKaracic , I cannot reproduce this error, either in tests or in the main class as you mentioned. Could you share the whole Main.scala file by any chance, as well as all relevant environment details regarding your platform, scala version, and zio version (thanks for mentioning the zio json version!).
Specifically, this file https://github.com/statsbomb/open-data/blob/master/data/competitions.json
The file is formatted as a json array, and I would like to read the file in a streaming fashion.
When opening the file with:
The entire file is read into a a single item, a json list (instead of providing a stream of each item in the list).
It also throws this error, but seems to recover from it:
When trying this to read the file as a
Stream[Competition]
I get a StackOverflowError
The stack points directly to the derived Competition class json codec.
Class and codec:
ZIO-json version:
0.6.2
The text was updated successfully, but these errors were encountered: