Parse two main arrays from one json file

Hi folks!

Parsing the .json file posted below is no problem.

But is it possible to parse only the talk array? talk and skill do not show up as maps.

(Sorry—this has probably asked quite a few times. But I could not find an answer.)

Thank you all!

  "talk": [
      "name": "Talk 1",
      "date": "2018-03-16"
      "name": "Talk 2",
      "date": "2018-03-17"
  "skill": [
      "name": "Skill 1"
      "name": "Skill 2"

Could you try posting the layout you used which did not work, and what error it produced? Using your file (saved as data/truc.json) with the following snippet works perfectly on my side:

{{ range }}{{ .name }}{{ end }}

It produces Talk 1Talk 2 as expected.

Oh gosh! I used {{ range $ }} (with “$”) as shown here:

Now, everyting is working. Thank you very much!

Amazing! If you take a closer look at the docs, it actually says $.Site and not $Site. $ is a reference to the main context (.) at the start of your template. So it’s basically making . still available in case you override it in your template (for example, in a range loop).

So $ being a dictionary (like the main context), you can access its values with the dot, like $.Site or $.Scratch.

You can find more infos about context in the docs.

Yes, true. I just did not pay attention because $ worked for data ranges in other templates/contexts.

Thanks again!

A post was merged into an existing topic: Get in an array external json