Translate c# to VB.NET : I am trying to use code from  [here][1] but my project is VB.NET
I tried few online converters but without much success. C# version works great but not VB.NET one. What might be the problem ?

  [1]: https://stackoverflow.com/questions/32961051/convert-nested-json-to-csv

My VB.NET version

            Dim arr As JArray = Nothing
            Dim obj As JObject = Nothing

            Try
                arr = JArray.Parse(json)
            Catch
            End Try

            If arr Is Nothing Then
                obj = JObject.Parse(arr.ToString())
            Else
                json = "{ Response: [" & json & "]}"
                obj = JObject.Parse(json)
            End If

            Dim values = obj.DescendantsAndSelf().OfType(Of JProperty)().Where(Function(p) TypeOf p.Value Is JValue).GroupBy(Function(p) p.Name).ToList()
            Dim columns = values.[Select](Function(g) g.Key).ToArray()
            Dim parentsWithChildren = values.SelectMany(Function(g) g).SelectMany(Function(v) v.AncestorsAndSelf().OfType(Of JObject)().Skip(1)).ToHashSet()
            Dim rows = obj.DescendantsAndSelf().OfType(Of JObject)().Where(Function(o) o.PropertyValues().OfType(Of JValue)().Any()).Where(Function(o) o = obj OrElse Not parentsWithChildren.Contains(o)).[Select](Function(o) columns.[Select](Function(c) o.AncestorsAndSelf().OfType(Of JObject)().[Select](Function(parent) parent(c)).Where(Function(v) TypeOf v Is JValue).[Select](Function(v) CStr(v)).FirstOrDefault()).Reverse().SkipWhile(Function(s) s Is Nothing).Reverse())
            Dim csvRows = {columns}.Concat(rows).[Select](Function(r) String.Join(",", r))
            Dim csv = String.Join(vbLf, csvRows)



