views:

81

answers:

2

I have a Spring controller in which I have to read a JSON object from a URLConnection. Currently I am doing this by reading from the connection's input stream line by line. Basically I am reading the text contents of the response line by line.

Is there any JSON api that I could use to populate the JSON object directly from the URLConnection? Anything that integrates with Spring?

A: 

Perhaps this is related? Essentially, implementing JsonView.

Raghuram
A: 

http://jackson.codehaus.org/1.6.0/javadoc/org/codehaus/jackson/JsonFactory.html#createJsonParser(java.io.InputStream) This could help, as URLConnection can return InputStream. What do you want to integrate with Spring, btw?

rsvato