I am receiving this json from an external server:
[["010117", "070117", "080117"], ["080117", "140117", "150117"], ["150117", "210117", "220117"]]
and i need to parse it
package main
import (
"encoding/json"
"fmt"
"io"
"os"
"runtime"
)
type Range struct {
From string
To string
Do string
}
type AllRanges struct {
Ranges []Range
}
func main() {
var ranges AllRanges
j, err := os.ReadFile(file)
if err != nil {
panic("Can't read json file")
}
if json.Unmarshal(j, &v) != nil {
panic("Error reading the json")
}
}
When I execute, a panic it is thrown indicating an error reading the json
Thanks in advance !