mercredi 15 juillet 2015

How can I dynamically generate a nested list of checkboxes in HTML from JSON?

I have a list of issues in a JSON file (see below), returned by a REST API, and I need to generate a nested list of checkboxes from this.

{
  "selectedissues": {
    "is1": "issue1",
    "is2": "issue2",
    "is3": {
      "name": "issue3",
      "children": {
        "is4": "issue3a",
        "is5": "issue3b"
      }
    },
    "is6": "issue4"
  }
}

Two questions:

  1. Is there a better way to get this data? I can change the format with some effort but JSON was just the example I was given. I'd like to to be fairly efficient and understandable and if there's an easier way to pass this data I'd love to hear it.
  2. How would I actually go about doing this? I'm completely new to any kind of web dev so am totally lost.



Aucun commentaire:

Enregistrer un commentaire