0

I'm using the API of GitLab in VB.Net. To request groups, I'm using GET /groups. GitLab returns a JSON string like this:

    [
       {
          "id":5,
          "web_url":"https://XXXXX/groups/AAAA",
          "name":"AAAA",
          "path":"AAAA",
          "description":"blabla",
          "visibility":"private",
          "share_with_group_lock":false,
          "require_two_factor_authentication":false,
          "two_factor_grace_period":48,
          "project_creation_level":"developer",
       },
       {
          "id":8,
          "web_url":"https://XXXXX/groups/BBBBBB",
          "name":"BBBBBB",
          "path":"BBBBBB",
          "description":"",
          "visibility":"private",
          "share_with_group_lock":false,
          "require_two_factor_authentication":false,
          "two_factor_grace_period":48,
          "parent_id":null,
          "ldap_cn":null,
          "ldap_access":null
       },
       etc ...
    ]

It's quite complicated to parse it with Newtonsoft.Json so I would like first to convert it to an array of Dictionary.

Then, I will be able to loop through the array and get myrow("id") for instance.

I couldn't find how to do this, could you help me please?

String (list of Dictionary) -> List (Dictionary)

Brian Rogers
  • 125,747
  • 31
  • 299
  • 300
  • 1
    "It's quite complicated to parse it with Newtonsoft json". Why do you say that? Have you created a class (eg *Group*) to deserialize to, eg `JsonConvert.DeserializeObject(oResponse.Content)`? – SteveCinq Dec 21 '20 at 15:47
  • 1
    From [How to auto-generate a C# class file from a JSON string](https://stackoverflow.com/q/21611674/3744182), https://jsonutils.com/ works for VB.NET as well. – dbc Dec 21 '20 at 16:55
  • How is this too complicated to parse with newtonsoft? That json looks about as simple as it gets? What makes it complicated? the number of properties? – Hursey Dec 21 '20 at 20:24
  • I have en error while parsing because of the first and last square brakets. – Beavis6511 Dec 22 '20 at 16:29

0 Answers0