Kotlin / Kotlin/dataframe

[Bug] `DataFrame.toJson()` does not recognize array columns correctly

Open
#2,046 0 comments 0 reactions 1 assignee Claimed by @AndreiKingsley View on GitHub
bug
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

Related to https://github.com/Kotlin/dataframe/issues/2045

```kt
DataFrame.readJsonStr("""[{"label":"record"},[123]]""")
```
turn into
```
label array
String? List
---- ----
0 record [ ]
1 null [123]
```

while the array-column detection of `toJson()` does not correctly mark `array` as an array-column; it assumes the values in the `array` column must be `null` when other columns have values.
So we get:
```kt
df.toJson()
```
```json
[{"label":"record","array":[]},{"label":null,"array":[123]}]
```

Expected behavior is to have it return to its original state.

Should be solved together with https://github.com/Kotlin/dataframe/issues/2048

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.