Package reddit.pojo.processing

Source Code of reddit.pojo.processing.SubredditJsonUnmarshaller

package reddit.pojo.processing;

import com.fasterxml.jackson.databind.ObjectMapper;

import reddit.pojo.SubredditJson;

public class SubredditJsonUnmarshaller {

    public static SubredditJson unmarshalJson(String jsonResponse) {
        ObjectMapper objectMapper = new ObjectMapper();
        SubredditJson subredditJson = null;
        try {
            subredditJson = objectMapper.readValue(jsonResponse, SubredditJson.class);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(String.format("unable to unmarshall json [%s]", jsonResponse));
        }
        return subredditJson;
    }

}
TOP

Related Classes of reddit.pojo.processing.SubredditJsonUnmarshaller

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.