read complex json object in html5 urgent

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

read complex json object in html5 urgent

niks27
Hello
I want to read json( which wud be nested or complex)returned by webservice in htmlpage
I need an example of that loop. Could u please provide

Thanks in advance

Reply | Threaded
Open this post in threaded view
|

Re: read complex json object in html5 urgent

niels
I don't understand your question. Do you call the web service from the browser via JS, then it's a JS-question which you better ask at stackoverflow.
If you call the webservice at server side just create Java objects and create your page as described in the documentation. If you than have a concrete question, feel free to ask again.

Niels
Reply | Threaded
Open this post in threaded view
|

Re: read complex json object in html5 urgent

niks27
thanks for quick reply

I have question like ...
 steps

 1) user will do some operation on client side.
 2) browser will make ajax call
 3) request will goto  backend java webservice
 4)  it will return json object as response
      (this json would be nested one or complex)

so now i want to display or loop through this Json and display data on HTML page using
thymeleaf syantax... so exact question is  i need syntax in thymeleaf to display data from Json
on html page . or could you give me an example html page in thymeleaf that would display json data.

 var data= {
                 "name":"ajax",
                 "j2ee":[
                              {
                                   "framework":[
                                                    {name:"abc"},
                                                     {value:"123"}
                                                   ]
                               }
                             ,{
                                   "framework":"hibernate"
                               }
                           ]
                   
              }
this j2ee array could array of objects or array of different maps... means it can be complex.
Could you please give me solution like how can i display this json in thymeleaf html page...
as I didnt get exact in documentation of thymeleaf.

Thanks again !!
Reply | Threaded
Open this post in threaded view
|

Re: read complex json object in html5 urgent

niels
I'm far away from being a Thymeleaf expert, but as mentioned in the first post, this is a JS-question. There is nothing Thymeleaf can do for you, because it's a server side template engine. You can use JQuery to build the html or search for JS template engines (Search for JS template engine) or look at http://garann.github.io/template-chooser/.