Code example for Gson

Methods: toJson

0
     
    @Get("json") 
    public Representation toJson() { 
        List<JuxtaAnnotation> list = getAnnotations(); 
         
        String json = this.gson.toJson( list );
        return toJsonRepresentation(json);
    } 
 
    private List<JuxtaAnnotation> getAnnotations() {
        // build the constraints for the request; range, text and qname filter 
        AnnotationConstraint constraint = new AnnotationConstraint( this.set.getId(), this.witness );
        constraint.setIncludeText( this.includeText );
        constraint.addRange( this.range );
        constraint.setFilter( this.filter );
         
        // get the constrained list of anotation data; convert to json  
        List<JuxtaAnnotation> list = this.annotationDao.list( constraint );
        return list;
    } 
Connect your IDE to all the code out there  Get Codota for Java