Last active
November 3, 2015 17:19
-
-
Save jonatasemidio/a293542bc90b7292b6ea to your computer and use it in GitHub Desktop.
Gerador de HTML apartir do JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = [name: 'nome do cara'] | |
s = "{name:'jonatas', idade: 10}".replace("'", "") | |
s = s.replace('{', '').replace('}', '') | |
println s.split(', ').each{ | |
name = it.split(':')[0] | |
value = it.split(':')[1] | |
println "<div class='item'>${m.name}: <input type='text' id='${m.name}' value='${value}'>" | |
} | |
/* | |
<div class='item'>nome do cara: <input type='text' id='nome do cara' value='jonatas'> | |
<div class='item'>nome do cara: <input type='text' id='nome do cara' value=' 10'> | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
out: