This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

parsing json from web  RSS feed

 
luca invernizzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have a http-url, the json file, and I need to parsing it.

How can I do it?
How I can retrieve and read it?
Is there any taglib that can I use?

very thanks in advance
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
on the server? Or on the client?
 
luca invernizzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to do the client.
The json file is already exist. I have to take it from a url and parse it whit jsp.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can request the JSON as text from the server with a HttpURLConnection, assuming you have the correct URL and there are no security obstacles.

The server does not care what the content is - different resources will be sent with different media types but thats about the only difference. For example, Tomcat will serve a file that has the .js type as "text/javascript".

"parse it with jsp" makes no sense - jsp executes on the server.


Bill
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66203
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
luca invernizzi wrote:I have to do the client.
The json file is already exist. I have to take it from a url and parse it whit jsp.


William is correct. if this needs to be done ont he client, then JSP isn;t the way. JSP runs on the server to send an HTML page to the client browser.

Getting JSON from script in the browser is easy with jQuery's $.getJSON() Ajax method. It will even do all the parsing.
 
luca invernizzi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, maybe I explained bad.

I have to write a web application that runs on the server.
The application must create an html page that shows the data read from the file json (from the URL https).
The client viewing the page with the data taken from the json file.

Now I try with the jQuery's $.getJSON() Ajax method.
Thanks.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!