客户端或服务器端的HTML转换构建器?

I've started using json2html but I have a fairly large piece of HTML that I need to transform.

Is there a better method of creating this transform other then using the transform builder via the site?

Are there client or server side tools that can take a piece of HTML with variables and create the required transform that gets passed to javascript?

Here is an example of what the transform would look like:

HTML:

<div id='${id}'>
<span>First Name: ${fname}</span>
<span>Last Name: ${lname}</span>
<span>Age: ${age}</span>
</div>

Transform:

{"tag":"div","id":"${id}","children":[
{"tag":"span","html":"First Name: ${fname}"},
{"tag":"span","html":"Last Name: ${lname}"},
{"tag":"span","html":"Age: ${age}"}
]}