Closed denisgermano closed 2 months ago
This is an issue with the core Rust engine. I get the same error in py-polars
:
import polars as pl
from io import StringIO
json_str = '[{"foo":"foo\nfoo","bar":6},{"foo":2,"bar":7},{"foo":3,"bar":"8\nfoo"}]'
pl.read_json(StringIO(json_str))
pydf = PyDataFrame.read_json(
^^^^^^^^^^^^^^^^^^^^^^
polars.exceptions.ComputeError: Syntax at character 0
Please raise this issue with the core team and close this ticket. I wish I could transfer this ticket to the core team but I do not have the permission. Thx
Thanks @Bidek56 Issue on core rust polars: https://github.com/pola-rs/polars/issues/18535
Have you tried latest version of polars?
What version of polars are you using?
nodejs-polars@0.15.0
What operating system are you using polars on?
MacOS 14.6.1 M2 Max
What node version are you using
Node v22.7.0
Describe your bug.
When using the pl.readJSON function to load NDJSON data, the function fails if any JSON string contains a newline character (\n). This issue is present even when the format option is set to "lines" as per the documentation.
What are the steps to reproduce the behavior?
What is the actual behavior?
Raise syntax error on parsing ndjson
What is the expected behavior?
To parse correctly as in a Stream
Results
What do you think polars should have done? Escape inner \n