I have some data being returned from javascript; the object looks like this:
let sched = [
["Sunday", 9.30, 12.00, 15.30, 22.00],
["Monday", 8.30, 12.00, 15.30, 19.00],
["Tuesday", 8.30, 12.00, 15.30, 19.00],
["Wednesday", 8.30, 12.00, 15.30, 19.00],
["Thursday", 8.30, 12.00, 15.30, 19.00],
["Friday",],
["Saturday", 8.00, 13.00]];
I'm trying to convert it into an array (2-dimensional, i think) in vb.net. Initially i thought i could use Newtonsoft JSON, but it is not well-formed. I'm doing it with a mess of string splits. Is there a better way?
Dim splitLines = _hours.Replace("""", "").Replace(" ", "").Replace(vbCrLf, "").TrimStart("[").TrimEnd("]").Split("],")
Dim result = splitLines.Select(Function(x) x.Trim.Replace("""", "").Replace("[", "").Split(","c)).ToArray()
Problem:
- For each weekday i'm returning an extract object at index 0 and value of ""
- Is there an easy way to parse something like this into a simple class?
_hoursactually contain? A string with theletstatement and all?