Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_json cannot parse a simple json array #18760

Open
2 tasks done
gschoeni opened this issue Sep 15, 2024 · 0 comments
Open
2 tasks done

read_json cannot parse a simple json array #18760

gschoeni opened this issue Sep 15, 2024 · 0 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@gschoeni
Copy link

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

I have a simple json array of strings

cat json_array.json | jq

[
  "test",
  "ing"
]
import polars as pl
pl.read_json("json_array.json")

And it throws an error parsing:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/gregschoeninger/.venv_oxen/lib/python3.10/site-packages/polars/io/json/read.py", line 96, in read_json
    pydf = PyDataFrame.read_json(
polars.exceptions.ComputeError: can only deserialize json objects

Log output

No response

Issue description

read_jsonCannot parse a simple json array of strings. attached the file.

json_array.json

Expected behavior

It should parse into a simple data frame with a single column of strings

Installed versions

--------Version info---------
Polars:              1.7.1
Index type:          UInt32
Platform:            macOS-14.6.1-arm64-arm-64bit
Python:              3.10.6 (main, Dec 11 2022, 04:44:05) [Clang 14.0.0 (clang-1400.0.29.102)]

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               5.2.0
cloudpickle          2.0.0
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               2023.9.2
gevent               <not installed>
great_tables         <not installed>
matplotlib           3.8.3
nest_asyncio         1.6.0
numpy                1.26.4
openpyxl             <not installed>
pandas               2.0.1
pyarrow              15.0.2
pydantic             2.5.3
pyiceberg            <not installed>
sqlalchemy           2.0.28
torch                2.1.1
xlsx2csv             <not installed>
xlsxwriter           <not installed>
@gschoeni gschoeni added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

1 participant