Jiab77 / Jiab77/json2html

Child tags not correctly closed

Open
#3 0 comments 0 reactions 1 assignee Claimed by @Jiab77 View on GitHub
help wanted PHP
Dominant language
Python
Stars
3
Forks
1
PR merge metrics
No merged PRs in 30d

Description

During my internal testing, it seems to fail when "html":"[]" contains more than 2 elements... :thinking:

```bash
Received:
string(190) "{"<>":"div","class":"${class}", "id":"${id}","html":[{"<>":"img", "src":"${src}","alt":"${alt}"},{"<>":"p","text":"Hi ${name}! Welcome to json2html!"},{"<>":"p","text":"Awesome it works!"}]}"
string(150) "[{"class":"card"}, {"id":"5d09870071631"}, {"src":"https://picsum.photos/id/557/400?random=5d09870071676"}, {"alt":"this is our logo"}, {"name":"Jo"}]"

Converted:
string(190) "

this is our logo

Hi Jo! Welcome to json2html!

Awesome it works!

"
```

First child is correct (self closing tag):
```html
this is our logo
```

Second child is added but mixed with the third child:
```html

Hi Jo! Welcome to json2html!

Awesome it works!
```

Then the closing tag code is executed:
```html


```

> I think the issue is related to this part (closing tag)

Complete `HTML` output:
```html

this is our logo

Hi Jo! Welcome to json2html!

Awesome it works!


```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.