public < T > List < T > collectionFromJson ( String json , Class < T > clazz ) throws JsonException { if ( json == null ) { return null ; } try { List < T > result = new ArrayList < T > ( ) ; List tempParseResult = ( List ) mapper . readValue ( json , new TypeReference < List < T > > ( ) { } ) ; for ( Object temp : tempParseResult ) { result . add ( fromJson ( toJson ( temp ) , clazz ) ) ; } return result ; } catch ( JsonParseException e ) { throw new JsonException ( e . getMessage ( ) , e ) ; } catch ( JsonMappingException e ) { throw new JsonException ( e . getMessage ( ) , e ) ; } catch ( IOException e ) { throw new JsonException ( e . getMessage ( ) , e ) ; } }
Converts a JsonString into a corresponding javaobject of the requested type .