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

x.json2 multidimensional array #22439

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions vlib/x/json2/tests/json2_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ fn test_struct_with_string_to_map() {
assert array_of_map.str() == '[{"val":"true"},{"val":"false"}]'
}

fn test_struct_with_array_of_arrays_to_map() {
array_of_struct := [StructType[[][]bool]{
val: [[false, true], [false, true]]
}, StructType[[][]bool]{
val: [[false, true], [false, true]]
}]

mut array_of_map := []json.Any{}

for variable in array_of_struct {
array_of_map << json.map_from(variable)
}

assert array_of_map.str() == '[{"val":[false,true]},{"val":[true,false]}]'
}

fn test_struct_with_array_to_map() {
array_of_struct := [StructType[[]bool]{
val: [false, true]
Expand Down
Loading