0

Say i have below html template

<html>
<body>
    <p>{{tested.object1}}</p>
    <p>{{tested.object2}}</p>
    <p>{{testedn.[0].object3}}</p>
</body>

Is there a way i can parse through it and generate required json payload/structure that can be used to feed this/such templates. In this case:

{ tested: { object1: '', object2: '' }, testedn: { '0': { object3: '' } } }

Most of the searches i did are leading to ways in which i can feed a already available json to such html templates. But nothing for other way around.

i have checked jMustache but couldnt find what i am looking for. Are there any leads on how i can achieve above in java?

bluefalcon
  • 505
  • 1
  • 5
  • 21

1 Answers1

0

Mustache or Handlebar is clearly not designed to do such a thing. You may try intead to convert your html flow to json using serialization. Try this post How to convert selected HTML to Json?

Community
  • 1
  • 1
Christophe
  • 2,131
  • 2
  • 21
  • 35