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

Deserialize CSV to nested composite types #48

Open
NeroBlackstone opened this issue May 8, 2024 · 1 comment
Open

Deserialize CSV to nested composite types #48

NeroBlackstone opened this issue May 8, 2024 · 1 comment

Comments

@NeroBlackstone
Copy link
Contributor

NeroBlackstone commented May 8, 2024

Currently, nested data cannot be deserialized correctly:

julia> struct NestedData
           id::Int
           name::String
       end

julia> struct Data
           id::Int
           nest::NestedData
       end

julia> data = [Data(1,NestedData(2,"a"))]
1-element Vector{Data}:
 Data(1, NestedData(2, "a"))

julia> csv = Serde.to_csv(data)
"id,nest_id,nest_name\n1,2,a\n"

julia> Serde.deser_csv(Data,csv)
ERROR: ParamError: parameter 'nest::NestedData' was not passed or has the value 'null'

Of course, this issue should be put on hold until we properly constrain Union types during serialization.

@NeroBlackstone NeroBlackstone changed the title Deserialize nested composite types Deserialize CSV to nested composite types May 8, 2024
@gryumov
Copy link
Member

gryumov commented Jul 4, 2024

It might seem easy to just use a delimiter, but what if the delimiter is also part of the data itself?

struct NestedData
    id::Int
    name_name::String <----
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants