APISonar


com.github.ltsopensource.core.json.JSON.parse

> com > github > ltsopensource > core > json > JSON > parse
com APIs github APIs ltsopensource APIs core APIs json APIs JSON APIs parse APIs

Example 1
public <T> T deserialize(InputStream in, Type type) throws IOException {
        String v = FileUtils.read(in, "UTF-8");
        return JSON.parse(v, type);
    }
Example 2
public void setAsText(String text) throws IllegalArgumentException {
        if (!StringUtils.hasText(text)) {
            setValue(null);
        } else {
            setValue(JSON.parse(text, new TypeReference<HashMap<String, String>>(){}));
        }
    }
Example 3
public static Decoder getDecoder() {
        return new FrameDecoder() {
            @Override
            protected Object decode(NioChannel channel, byte[] frame) throws Exception {
                String json = new String(frame, "UTF-8");
                RemotingMsg msg = JSON.parse(json, new TypeReference<RemotingMsg>() {
                });
                return msg;
            }
        };
    }
Example 4
private List<MData> getMDataList(NodeType nodeType, String mDataJson) {
        List<MData> mDatas = null;
        if (NodeType.TASK_TRACKER == nodeType) {
            mDatas = JSON.parse(mDataJson, new TypeReference<List<TaskTrackerMData>>() {
            }.getType());
        } else if (NodeType.JOB_TRACKER == nodeType) {
            mDatas = JSON.parse(mDataJson, new TypeReference<List<JobTrackerMData>>() {
            }.getType());
        } else if (NodeType.JOB_CLIENT == nodeType) {
            mDatas = JSON.parse(mDataJson, new TypeReference<List<JobClientMData>>() {
            }.getType());
        }
        return mDatas;
    }