Jinja2 - How to loop a json list? - json

How can I loop a json list with jinja2?
I have this json list,
[
{
"first_name": "John",
"last_name": "Smith",
"user_id": 4,
"address": null
},
{
"first_name": "Jane",
"last_name": "Heart",
"user_id": 5,
"address": null
},
{
"first_name": "Dom",
"last_name": "Robinsons",
"user_id": 6,
"address": null
},
{
"first_name": "Pete",
"last_name": "Hand",
"user_id": 7,
"address": null
}
]
page.html,
<table>
{% for user in users %}
<tr><td>{{ user.first_name }}</td></tr>
{% endfor %}
</table>
Result,
<table>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
<tr><td></td></tr>
...
Any ideas?

your json list contains dictionaries; you need to access the dictionary elements differently than you would class members; try:
<tr><td>{{ user['first_name'] }}</td></tr>
this works for me (python 3.4 and python 2.7)
import json
from jinja2 import Template
json_str = '''[{"first_name": "John", "last_name": "Smith", "user_id": 4,
"address": null}, {"first_name": "Jane", "last_name": "Heart",
"user_id": 5, "address": null}, {"first_name": "Dom",
"last_name": "Robinsons", "user_id": 6, "address": null},
{"first_name": "Pete", "last_name": "Hand", "user_id": 7,
"address": null}]'''
users = json.loads(json_str)
tmpl = Template('''
<table>
{% for user in users %}
<tr><td>{{ user['first_name'] }}</td></tr>
{% endfor %}
</table>
''')
print(tmpl.render(users = users))
output:
<table>
<tr><td>John</td></tr>
<tr><td>Jane</td></tr>
<tr><td>Dom</td></tr>
<tr><td>Pete</td></tr>
</table>

simple json iteration in jinja2
<table>
<tr>
{% for key in users[0] %}
<th>{{ key }}</th>
{% endfor %}
</tr>
{% for user in users %}
<tr>
{% for key in user %}
<td>{{ user[key] }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>

Related

Edit element.style in HTML code in Shopify

I would like to add a style to a banner in the Shopify-Code. (A padding and a backgroudn color)
This banner has no deticated css that only applies to these kind of banners (or i can not find it) so i have to edit the element.style.
Could you help me how to edit this?
I attached an image with the changes i want to make
I think this is the part of the code where the changes should be made:
{{ 'section-image-banner.css' | asset_url | stylesheet_tag }}
{%- if section.settings.adapt_height_first_image and section.settings.image != blank -%}
{%- style -%}
#media screen and (max-width: 749px) {
#Banner-{{ section.id }}::before,
#Banner-{{ section.id }} .banner__media::before,
#Banner-{{ section.id }}:not(.banner--mobile-bottom) .banner__content::before {
padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;
content: '';
display: block;
}
}
#media screen and (min-width: 750px) {
#Banner-{{ section.id }}::before,
#Banner-{{ section.id }} .banner__media::before {
padding-bottom: {{ 1 | divided_by: section.settings.image.aspect_ratio | times: 100 }}%;
content: '';
display: block;
}
}
{%- endstyle -%}
{%- endif -%}
{%- style -%}
#Banner-{{ section.id }}::after {
opacity: {{ section.settings.image_overlay_opacity | divided_by: 100.0 }};
}
{%- endstyle -%}
<div id="Banner-{{ section.id }}" class="banner banner--content-align-{{ section.settings.desktop_content_alignment }} banner--content-align-mobile-{{ section.settings.mobile_content_alignment }} banner--{{ section.settings.image_height }}{% if section.settings.stack_images_on_mobile and section.settings.image != blank and section.settings.image_2 != blank %} banner--stacked{% endif %}{% if section.settings.adapt_height_first_image and section.settings.image != blank %} banner--adapt{% endif %}{% if section.settings.show_text_below %} banner--mobile-bottom{%- endif -%}{% if section.settings.show_text_box == false %} banner--desktop-transparent{% endif %}">
{%- if section.settings.image != blank -%}
<div class="banner__media media{% if section.settings.image == blank and section.settings.image_2 == blank %} placeholder{% endif %}{% if section.settings.image_2 != blank %} banner__media-half{% endif %}">
{%-liquid
assign image_height = section.settings.image.width | divided_by: section.settings.image.aspect_ratio
if section.settings.image_2 != blank
assign image_class = "banner__media-image-half"
endif
if section.settings.image_2 != blank and section.settings.stack_images_on_mobile
assign sizes = "(min-width: 750px) 50vw, 100vw"
elsif section.settings.image_2 != blank
assign sizes = "50vw"
else
assign sizes = "100vw"
endif
-%}
{{ section.settings.image | image_url: width: 1500 | image_tag:
loading: 'lazy',
width: section.settings.image.width,
height: image_height,
class: image_class,
sizes: sizes,
widths: '375, 550, 750, 1100, 1500, 1780, 2000, 3000, 3840',
alt: section.settings.image.alt | escape
} </div>
{%- elsif section.settings.image_2 == blank -%}
<div class="banner__media media{% if section.settings.image == blank and section.settings.image_2 == blank %} placeholder{% endif %}{% if section.settings.image_2 != blank %} banner__media-half{% endif %}">
{{ 'lifestyle-2' | placeholder_svg_tag: 'placeholder-svg' }}
</div>
{%- endif -%}
{%- if section.settings.image_2 != blank -%}
<div class="banner__media media{% if section.settings.image != blank %} banner__media-half{% endif %}">
{%-liquid
assign image_height_2 = section.settings.image_2.width | divided_by: section.settings.image_2.aspect_ratio
if section.settings.image != blank
assign image_class_2 = "banner__media-image-half"
endif
if section.settings.image != blank and section.settings.stack_images_on_mobile
assign sizes = "(min-width: 750px) 50vw, 100vw"
elsif section.settings.image != blank
assign sizes = "50vw"
else
assign sizes = "100vw"
endif
-%}
{{ section.settings.image_2 | image_url: width: 1500 | image_tag:
loading: 'lazy',
width: section.settings.image_2.width,
height: image_height_2,
class: image_class_2,
sizes: sizes,
widths: '375, 550, 750, 1100, 1500, 1780, 2000, 3000, 3840',
alt: section.settings.image_2.alt | escape
}}
</div>
{%- endif -%}
<div class="banner__content banner__content--{{ section.settings.desktop_content_position }} page-width">
<div class="banner__box content-container content-container--full-width-mobile color-{{ section.settings.color_scheme }} gradient">
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'heading' -%}
<h2 class="banner__heading {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>
<span>{{ block.settings.heading | escape }}</span>
</h2>
{%- when 'text' -%}
<div class="banner__text {{ block.settings.text_style }}" {{ block.shopify_attributes }}>
<span>{{ block.settings.text | escape }}</span>
</div>
{%- when 'buttons' -%}
<div class="banner__buttons{% if block.settings.button_label_1 != blank and block.settings.button_label_2 != blank %} banner__buttons--multiple{% endif %}" {{ block.shopify_attributes }}>
{%- if block.settings.button_label_1 != blank -%}
<a{% if block.settings.button_link_1 == blank %} role="link" aria-disabled="true"{% else %} href="{{ block.settings.button_link_1 }}"{% endif %} class="button{% if block.settings.button_style_secondary_1 %} button--secondary{% else %} button--primary{% endif %}">{{ block.settings.button_label_1 | escape }}</a>
{%- endif -%}
{%- if block.settings.button_label_2 != blank -%}
<a{% if block.settings.button_link_2 == blank %} role="link" aria-disabled="true"{% else %} href="{{ block.settings.button_link_2 }}"{% endif %} class="button{% if block.settings.button_style_secondary_2 %} button--secondary{% else %} button--primary{% endif %}">{{ block.settings.button_label_2 | escape }}</a>
{%- endif -%}
</div>
{%- endcase -%}
{%- endfor -%}
</div>
</div>
</div>
{% schema %}
{
"name": "t:sections.image-banner.name",
"tag": "section",
"class": "section",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "t:sections.image-banner.settings.image.label"
},
{
"type": "image_picker",
"id": "image_2",
"label": "t:sections.image-banner.settings.image_2.label"
},
{
"type": "range",
"id": "image_overlay_opacity",
"min": 0,
"max": 100,
"step": 10,
"unit": "%",
"label": "t:sections.image-banner.settings.image_overlay_opacity.label",
"default": 0
},
{
"type": "select",
"id": "image_height",
"options": [
{
"value": "small",
"label": "t:sections.image-banner.settings.image_height.options__1.label"
},
{
"value": "medium",
"label": "t:sections.image-banner.settings.image_height.options__2.label"
},
{
"value": "large",
"label": "t:sections.image-banner.settings.image_height.options__3.label"
}
],
"default": "medium",
"label": "t:sections.image-banner.settings.image_height.label",
"info": "t:sections.image-banner.settings.image_height.info"
},
{
"type": "checkbox",
"id": "adapt_height_first_image",
"default": false,
"label": "t:sections.image-banner.settings.adapt_height_first_image.label",
"info": "t:sections.image-banner.settings.adapt_height_first_image.info"
},
{
"type": "select",
"id": "desktop_content_position",
"options": [
{
"value": "top-left",
"label": "t:sections.image-banner.settings.desktop_content_position.options__1.label"
},
{
"value": "top-center",
"label": "t:sections.image-banner.settings.desktop_content_position.options__2.label"
},
{
"value": "top-right",
"label": "t:sections.image-banner.settings.desktop_content_position.options__3.label"
},
{
"value": "middle-left",
"label": "t:sections.image-banner.settings.desktop_content_position.options__4.label"
},
{
"value": "middle-center",
"label": "t:sections.image-banner.settings.desktop_content_position.options__5.label"
},
{
"value": "middle-right",
"label": "t:sections.image-banner.settings.desktop_content_position.options__6.label"
},
{
"value": "bottom-left",
"label": "t:sections.image-banner.settings.desktop_content_position.options__7.label"
},
{
"value": "bottom-center",
"label": "t:sections.image-banner.settings.desktop_content_position.options__8.label"
},
{
"value": "bottom-right",
"label": "t:sections.image-banner.settings.desktop_content_position.options__9.label"
}
],
"default": "middle-center",
"label": "t:sections.image-banner.settings.desktop_content_position.label"
},
{
"type": "checkbox",
"id": "show_text_box",
"default": true,
"label": "t:sections.image-banner.settings.show_text_box.label"
},
{
"type": "select",
"id": "desktop_content_alignment",
"options": [
{
"value": "left",
"label": "t:sections.image-banner.settings.desktop_content_alignment.options__1.label"
},
{
"value": "center",
"label": "t:sections.image-banner.settings.desktop_content_alignment.options__2.label"
},
{
"value": "right",
"label": "t:sections.image-banner.settings.desktop_content_alignment.options__3.label"
}
],
"default": "center",
"label": "t:sections.image-banner.settings.desktop_content_alignment.label"
},
{
"type": "select",
"id": "color_scheme",
"options": [
{
"value": "accent-1",
"label": "t:sections.all.colors.accent_1.label"
},
{
"value": "accent-2",
"label": "t:sections.all.colors.accent_2.label"
},
{
"value": "background-1",
"label": "t:sections.all.colors.background_1.label"
},
{
"value": "background-2",
"label": "t:sections.all.colors.background_2.label"
},
{
"value": "inverse",
"label": "t:sections.all.colors.inverse.label"
}
],
"default": "background-1",
"label": "t:sections.all.colors.label",
"info": "t:sections.image-banner.settings.color_scheme.info"
},
{
"type": "header",
"content": "t:sections.image-banner.settings.header.content"
},
{
"type": "select",
"id": "mobile_content_alignment",
"options": [
{
"value": "left",
"label": "t:sections.image-banner.settings.mobile_content_alignment.options__1.label"
},
{
"value": "center",
"label": "t:sections.image-banner.settings.mobile_content_alignment.options__2.label"
},
{
"value": "right",
"label": "t:sections.image-banner.settings.mobile_content_alignment.options__3.label"
}
],
"default": "center",
"label": "t:sections.image-banner.settings.mobile_content_alignment.label"
},
{
"type": "checkbox",
"id": "stack_images_on_mobile",
"default": true,
"label": "t:sections.image-banner.settings.stack_images_on_mobile.label"
},
{
"type": "checkbox",
"id": "show_text_below",
"default": true,
"label": "t:sections.image-banner.settings.show_text_below.label"
}
],
"blocks": [
{
"type": "heading",
"name": "t:sections.image-banner.blocks.heading.name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "heading",
"default": "Image banner",
"label": "t:sections.image-banner.blocks.heading.settings.heading.label"
},
{
"type": "select",
"id": "heading_size",
"options": [
{
"value": "h2",
"label": "t:sections.all.heading_size.options__1.label"
},
{
"value": "h1",
"label": "t:sections.all.heading_size.options__2.label"
},
{
"value": "h0",
"label": "t:sections.all.heading_size.options__3.label"
}
],
"default": "h1",
"label": "t:sections.all.heading_size.label"
}
]
},
{
"type": "text",
"name": "t:sections.image-banner.blocks.text.name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "text",
"default": "Give customers details about the banner image(s) or content on the template.",
"label": "t:sections.image-banner.blocks.text.settings.text.label"
},
{
"type": "select",
"id": "text_style",
"options": [
{
"value": "body",
"label": "t:sections.image-banner.blocks.text.settings.text_style.options__1.label"
},
{
"value": "subtitle",
"label": "t:sections.image-banner.blocks.text.settings.text_style.options__2.label"
},
{
"value": "caption-with-letter-spacing",
"label": "t:sections.image-banner.blocks.text.settings.text_style.options__3.label"
}
],
"default": "body",
"label": "t:sections.image-banner.blocks.text.settings.text_style.label"
}
]
},
{
"type": "buttons",
"name": "t:sections.image-banner.blocks.buttons.name",
"limit": 1,
"settings": [
{
"type": "text",
"id": "button_label_1",
"default": "Button label",
"label": "t:sections.image-banner.blocks.buttons.settings.button_label_1.label",
"info": "t:sections.image-banner.blocks.buttons.settings.button_label_1.info"
},
{
"type": "url",
"id": "button_link_1",
"label": "t:sections.image-banner.blocks.buttons.settings.button_link_1.label"
},
{
"type": "checkbox",
"id": "button_style_secondary_1",
"default": false,
"label": "t:sections.image-banner.blocks.buttons.settings.button_style_secondary_1.label"
},
{
"type": "text",
"id": "button_label_2",
"default": "Button label",
"label": "t:sections.image-banner.blocks.buttons.settings.button_label_2.label",
"info": "t:sections.image-banner.blocks.buttons.settings.button_label_2.info"
},
{
"type": "url",
"id": "button_link_2",
"label": "t:sections.image-banner.blocks.buttons.settings.button_link_2.label"
},
{
"type": "checkbox",
"id": "button_style_secondary_2",
"default": false,
"label": "t:sections.image-banner.blocks.buttons.settings.button_style_secondary_2.label"
}
]
}
],
"presets": [
{
"name": "t:sections.image-banner.presets.name",
"blocks": [
{
"type": "heading"
},
{
"type": "text"
},
{
"type": "buttons"
}
]
}
]
}
{% endschema %}
I attached an image with the changes i want to make.
Basically i addeted
padding: 0 5rem;
background-color: #FFFFFF;
to the element.style in google Chrome DevTool

Recursion in jinja template

I need to provide a JSON formatted information from a CMS into a web page.
There may be deep nested structures in the page input like:
{
"input": [
{
"header": "sample header text",
"description": "sample description text",
"content": {
"json": {
"children": [
{
"type": "paragraph",
"children": [
{
"text": "sample child text "
},
{
"href": "https://myorg/tilasto/kony",
"type": "link",
"title": "Linkki ",
"children": [
{
"text": "sample child text"
}
]
},
{
"text": "sample child text"
}
]
},
{
"type": "table",
"children": [
{
"type": "table_body",
"children": [
{
"type": "table_row",
"children": [
{
"type": "table_cell",
"children": [
{
"type": "paragraph",
"children": [
{
"text": "sample text"
}
]
},
{
"type": "table",
"children": [
{
"text": "sample text"
}
]
},
{
"type": "paragraph",
"children": [
{
"text": "sample text"
}
]
}
]
},
{
"type": "table_cell",
"children": [
{
"type": "paragraph",
"children": [
{
"text": "sample text"
}
]
}
]
}
]
}
]
}
]
}
]
},
"references": [
]
}
}
]
}
How can I recursively do the same thing as in the below HTML?
{% for tiedote in input %}
<br>
<h2> {{tiedote.header}}</h2>
<p> {{tiedote.description}} </p>
{% for children_list in tiedote.content.json.children %}
{% for child in children_list.children %}
<p> {{child.text}} </p>
<a href="{{child.href}}">
{% for chil in child.children %}
<p> {{chil.text}} </p>
<a href="{{chil.href}}">
{% for chi in chil.children %}
<p> {{chi.text}} </p>
<a href="{{chi.href}}">
{% for ch in chi.children %}
<p> {{ch.text}} </p>
<a href="{{ch.href}}">
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}
Also href may be present in some level of the input, how can I check if it is present or not?
Updated: In order to use macro (as in answer) in jinja template do I need to install django-macros or would there be any other means for that?

How to create one json file with multiple entries using jinja2 template in ansible?

I am trying to create a json file with multiple secret (dictionary) and storage class. But the template is created in such a way that it will create multiple json file with single secret and a storage class in each file.
my template (resources.j2) is look below
"secret": [
{
"name": "secret{{ user_name }}",
"label": "{{ user_name }}",
"backend": "{{ local_array_ip }}",
"username": "{{ user_name }}",
"password": "{{password | default('test123')}}",
"namespace": "{{ default_namespace }}"
}
],
"storageclass": [
{
"name": "sc{{ user_name }}",
"secret": "{{ user_name }}",
"label": "sc-{{ user_name }}",
"limitMbps": "800",
"fstype": "xfs",
"accessProtocol": "{{ protocol }}"
}
]
}
I am creating json inside a library file which is called in loop
- name: Create config files for mulitple users
include: lib/create_config_for_multiple_users.yaml
vars:
user_name: "{{ userName }}{{iterationCount}}"
with_sequence: count="5"
loop_control:
loop_var: iterationCount
In the Create_config_for_multiple_users.yml , it is creating json file for each user (so totally 5 json files are getting created). Creation of json file from template is given below.
- set_fact:
tmp_dynamic_json_file: "/tmp/temp-json-{{User}}-{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%s') }}.json"
- name: Create dynamic Json file with user
template:
dest: "{{tmp_dynamic_json_file}}"
src: "resources.j2"
delegate_to: localhost
Actually i wanted one single json file with multiple entries like below.
"secret": [
{
"name": "secrettest1",
"label": "test1",
"backend": "{{ local_array_ip }}",
"username": "test1",
"password": "test123",
"namespace": "kube-system"
},
{
"name": "secrettest2",
"label": "test2",
"backend": "{{ local_array_ip }}",
"username": "test2",
"password": "test123",
"namespace": "kube-system"
}
],
"storageclass": [
{
"name": "sctest1",
"secret": "test1",
"label": "sc-test1",
"limitMbps": "800",
"fstype": "xfs",
"accessProtocol": "iscsi"
},
{
"name": "sctest2",
"secret": "test2",
"label": "sc-test2",
"limitMbps": "800",
"fstype": "xfs",
"accessProtocol": "iscsi"
}
]
}
I don't know how to create template in such a way that it will create only one json.
You are including create_config_for_multiple_users.yaml tasks which effectively iterates over the template: task. If the template task runs multiple times, it creates multiple templates. The iteration in this case, should be within the template. The template task should be only used/invoked once.
Please see the example playbook below. I am including a task file as you do, but it doesn't matter.
vars:
userName: 'test'
local_array_ip: '192.168.1.1'
default_namespace: 'kube-system'
protocol: 'iscsi'
tasks:
- name: Create config files for mulitple users
include: create_config.yml
Then in my create_config.yml, I use the template module:
- name: Create dynamic Json file with user
template:
dest: '/tmp/resources.json'
src: 'resources.json.j2'
Then comes the iteration for user numbers in the template resources.json.j2:
{
"secret": [
{% for user_num in range(1, 6) %}
{
"name": "secret{{ userName }}{{ user_num }}",
"label": "{{ userName }}{{ user_num }}",
"backend": "{{ local_array_ip }}",
"username": "{{ userName }}{{ user_num }}",
"password": "{{ password | default('test123') }}",
"namespace": "{{ default_namespace }}"
}{% if user_num < 5 %},{% endif %}
{% endfor %}
],
"storageclass": [
{% for user_num in range(1, 6) %}
{
"name": "sc{{ userName }}{{ user_num }}",
"secret": "{{ userName }}{{ user_num }}",
"label": "sc-{{ userName }}{{ user_num }}",
"limitMbps": "800",
"fstype": "xfs",
"accessProtocol": "{{ protocol }}"
}{% if user_num < 5 %},{% endif %}
{% endfor %}
]
}
I am creating a destination JSON file with a simple name /tmp/resources.json (abridged).
{
"secret": [
{
"name": "secrettest1",
"label": "test1",
"backend": "192.168.1.1",
"username": "test1",
"password": "test123",
"namespace": "kube-system"
},
{
"name": "secrettest2",
"label": "test2",
"backend": "192.168.1.1",
"username": "test2",
"password": "test123",
"namespace": "kube-system"
},
"storageclass": [
{
"name": "sctest1",
"secret": "test1",
"label": "sc-test1",
"limitMbps": "800",
"fstype": "xfs",
"accessProtocol": "iscsi"
},
{
"name": "sctest2",
"secret": "test2",
"label": "sc-test2",
"limitMbps": "800",
"fstype": "xfs",
"accessProtocol": "iscsi"
},

An error prevented faq.liquid from being saved

I am trying to add a FAQ section with blocks to a Shopify theme. I am able to dynamically add the section without blocks, but once I try to add blocks I keep getting the error message
"An error prevented faq.liquid from being saved."
I am not sure exactly what the problem is or why its not working since that is a very vague error message.
Here is my code:
<hr>
<div id="section-faq">
<div class="section-header text-center">
<h3> {{ section.settings.text-box }} </h3>
</div>
{% for block in section.blocks %}
<div class="btn" id="faq">
<a href="{{ block.settings.text-box }}" class="btn">{{ block.settings.text
}}</a>
</div>
{% endfor %}
</div>
<hr>
{% schema %}
{
"name": "faq",
"max_blocks": 6,
"settings": [
{
"id": "text-box",
"type": "text",
"label": "Heading",
"default": "FAQ"
}
],
"blocks": [
{
"type": "QA",
"name": "QA",
"settings": [
{
"id": "text-box",
"type": "text",
"label": "Question",
"default": "Add Question"
},
{
"id": "text",
"type": "richtext",
"label": "Answer",
"default": "<p>Add your answer here</p>"
}
]
}
],
"presets": [
{
"name": "FAQ",
"category": "Faq"
}
]
}
{% endschema %}
I have checked and created new section and add your code and its working fine for me.

build a JSON from Django-mptt

I am trying to build up a json from a tree structure. I use django-mptt to build the tree. But impossible for me to create a JSON out of it.
I want the json to look like this:
[
{"name": "Parent 1",
"child": [
{"name": "Child 1-1"},
{"name": "Child 1-2"},
{"name": "Child 1-3"}
]},
{"name": "Parent 2",
"child": [
{"name": "Child 2-1"},
{"name": "Child 2-2"},
{"name": "Child 2-3"
,"child": [
{"name": "Child 2-3-1"},
{"name": "Child 2-3-2"}
]
}
]
}
];
It can have multiple/unlimited children.
So far I tried this. But unable to get the right syntax for the JSON
var json = [
{% recursetree nodes %}
{"text": "{{ node.item_title }}"
{% if not node.is_leaf_node %}
,"nodes": [
{{ children }}
{% endif %}
},
{% endrecursetree %}
];
This gets me this output:
var json = [
{"name": "Parent 1"
,"child": [
{"name": "Child 1-1"
},
{"name": "Child 1-2"
},
{"name": "Child 1-3"
},
},
{"name": "Parent 2"
,"child": [
{"name": "Child 2-1"
},
{"name": "Child 2-2"
},
{"name": "Child 2-3"
,"child": [
{"name": "Child 2-3-1"
},
{"name": "Child 2-3-2"
},
},
];
I cant figure out how to get the parentesis and hooks at the right places.
I'm really stuck! Can somebody help me out? Thanks.