Requesting help with content adapter

I would like to create pages from external JSON data. The data is in the format below. Could anyone guide me on how the content adapter should look like so it captures all details in this data? Some tips

  1. URL should be countyName/state/name /county-name/constituency-name-1
  2. Title should be state/name ConstituencyName1.
  3. The wards in square bracket should appear in range (e.g so I can do ward name on the left and its polling stations on the right in a table) e.g
Ward Name Polling Stations
WardName1 PollingStation1, PollingStation2, PollingStation3
Summary
[
  {
    "name": "CountyName",
    "states": [
      {
        "name": "ConstituencyName1",
        "wards": [
          {
            "name": "WardName1",
            "pollingStations": [
              {
                "name": "PollingStation1"
              },
              {
                "name": "PollingStation2"
              },
              {
                "name": "PollingStation3"
              }
            ]
          }
        ]
      },
      {
        "name": "ConstituencyName2",
        "wards": [
          {
            "name": "WardName2",
            "pollingStations": [
              {
                "name": "PollingStation4"
              },
              {
                "name": "PollingStation5"
              },
              {
                "name": "PollingStation6"
              }
            ]
          }
        ]
      }
    ]
  }
]

Thanks in advance.

git clone --single-branch -b hugo-forum-topic-55742 https://github.com/jmooring/hugo-testing hugo-forum-topic-55742
cd hugo-forum-topic-55742
hugo server

This stuffs the wards into the page params, rendering as a table in layouts/page.html.

4 Likes

Thanks a lot Joe. It worked.

1 Like

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