Create struct from text file and then convert in to json

Hello! I have unorganized text file with many lines. I should this text file turn to json file.
Text file example:

value       value
value              value             value    value
value                         value   valu    value value
.... (and so on)

After converting above text file to json will be:
{ “row1”: {
“value1”:value
“value2”:value
}
“row2”: {
“value1”:value
“value2”:value
“value3”:value
“value4”:value
}
“row3”: {
“value1”:value
“value2”:value
“value3”:value
“value4”:value
“value5”:value
}

first I have to create a dynamic struct, then convert to json, please help

Is it possible to use a slice?
Split each line using white space, trim each segmwnt using white space then you can use a struct
type Row struct {
Index int
Name string
Values []int
}
or a map
map[string][]int

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.