Skip to content

Instantly share code, notes, and snippets.

@pulkitsinghal
Created September 3, 2012 22:41
Show Gist options
  • Select an option

  • Save pulkitsinghal/3614268 to your computer and use it in GitHub Desktop.

Select an option

Save pulkitsinghal/3614268 to your computer and use it in GitHub Desktop.
import java.util.LinkedList;
/**
* I'm employing this super-hacky class which breaks the Java
* class uppercasing conventions because, I want to get the following JSON:
{
"products":[
{...},
{...}
]
}
*
* 1) BUT with code:
* @Produces(MediaType.APPLICATION_JSON)
* public Product[] ... {
* resource.get(new GenericType<List<Product>>(){});
* return products_response.toArray(new Product[0]);
* }
{
"Product[]":[
{...},
{...}
]
}
*
* 2) AND with code:
* @Produces(MediaType.APPLICATION_JSON)
* public List<Product> ... {
* resource.get(new GenericType<List<Product>>(){});
* return products_response;
* }
* The JSON tends to come out looking like:
{
"List":[
{...},
{...}
]
}
* None of which is in the desired form.
*
* @author pulkitsinghal
*
*/
public class products<E> extends LinkedList<E> {
private static final long serialVersionUID = 4433491566929410574L;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment