本文整理了Java中com.alibaba.fastjson.JSON.parseObject()
方法的一些代码示例,展示了JSON.parseObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSON.parseObject()
方法的具体详情如下:
包路径:com.alibaba.fastjson.JSON
类名称:JSON
方法名:parseObject
暂无
代码示例来源:origin: alibaba/fastjson
public String[] decode(String content) throws IOException {
return JSON.parseObject(content, String[].class);
}
代码示例来源:origin: alibaba/fastjson
public String[] decodeInputStream(InputStream content) throws IOException {
return JSON.parseObject(content, String[].class);
}
代码示例来源:origin: hs-web/hsweb-framework
private Map<String, Object> parseObject(String json) {
if (!StringUtils.hasText(json)) {
return null;
}
return JSON.parseObject(json);
}
代码示例来源:origin: apache/incubator-dubbo
private <T> T read(Class<T> cls) throws IOException {
String json = readLine();
return JSON.parseObject(json, cls);
}
}
代码示例来源:origin: apache/incubator-dubbo
private <T> T read(Class<T> cls) throws IOException {
String json = readLine();
return JSON.parseObject(json, cls);
}
}
代码示例来源:origin: alibaba/fastjson
public Object deserialize(byte[] bytes) throws SerializationException {
if (bytes == null || bytes.length == 0) {
return null;
}
try {
return JSON.parseObject(new String(bytes, IOUtils.UTF8), Object.class, defaultRedisConfig);
} catch (Exception ex) {
throw new SerializationException("Could not deserialize: " + ex.getMessage(), ex);
}
}
}
代码示例来源:origin: hs-web/hsweb-framework
private void initEnv() throws IOException {
try {
this.jsonConfig = JSON.parseObject(FileUtils.reader2String(configFileName));
} catch (Exception e) {
log.warn("read ueditor config file error", e);
this.jsonConfig = null;
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public DataAccessConfig convert(String type, String action, String config) {
if (StringUtils.isEmpty(config)) {
config = "{}";
}
ScopeByUserDataAccessConfig dataAccessConfig = JSON.parseObject(config, ScopeByUserDataAccessConfig.class);
dataAccessConfig.setAction(action);
return dataAccessConfig;
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public AuthenticationBuilder attributes(String attributes) {
authentication.setAttributes(JSON.<Map<String, Serializable>>parseObject(attributes, Map.class));
return this;
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
@Cacheable(value = "dyn-form-deploy", key = "'form-deploy:'+#formId+':latest'")
public DynamicFormColumnBindEntity selectLatestDeployed(String formId) {
DynamicFormDeployLogEntity entity = dynamicFormDeployLogService.selectLastDeployed(formId);
if (entity == null) {
return null;
}
return JSON.parseObject(entity.getMetaData(), DynamicFormColumnBindEntity.class);
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public DataAccessConfig convert(String type, String action, String config) {
if (StringUtils.isEmpty(config)) {
config = "{}";
}
SimpleScopeDataAccessConfig accessConfig = JSON.parseObject(config, SimpleScopeDataAccessConfig.class);
accessConfig.setAction(action);
accessConfig.setType(type);
return accessConfig;
}
}
代码示例来源:origin: code4craft/webmagic
public <T> T toObject(Class<T> clazz) {
if (getFirstSourceText() == null) {
return null;
}
return JSON.parseObject(getFirstSourceText(), clazz);
}
代码示例来源:origin: alibaba/Sentinel
private void initServerTransportConfigProperty() {
ReadableDataSource<String, ServerTransportConfig> serverTransportDs = new NacosDataSource<>(remoteAddress, groupId,
clusterMapDataId, source -> {
List<ClusterGroupEntity> groupList = JSON.parseObject(source, new TypeReference<List<ClusterGroupEntity>>() {});
return Optional.ofNullable(groupList)
.flatMap(this::extractServerTransportConfig)
.orElse(null);
});
ClusterServerConfigManager.registerServerTransportProperty(serverTransportDs.getProperty());
}
代码示例来源:origin: code4craft/webmagic
private Request getExtrasInItem(Jedis jedis, String url, Task task)
{
String key = getItemKey(task);
String field = DigestUtils.shaHex(url);
byte[] bytes = jedis.hget(key.getBytes(), field.getBytes());
if(bytes != null)
return JSON.parseObject(new String(bytes), Request.class);
return new Request(url);
}
}
代码示例来源:origin: alibaba/canal
@Override
protected RdsBackupPolicy processResult(HttpResponse response) throws Exception {
String result = EntityUtils.toString(response.getEntity());
JSONObject jsonObj = JSON.parseObject(result);
RdsBackupPolicy policy = new RdsBackupPolicy();
policy.setBackupRetentionPeriod(jsonObj.getString("BackupRetentionPeriod"));
policy.setBackupLog(jsonObj.getString("BackupLog").equalsIgnoreCase("Enable"));
policy.setLogBackupRetentionPeriod(jsonObj.getIntValue("LogBackupRetentionPeriod"));
policy.setPreferredBackupPeriod(jsonObj.getString("PreferredBackupPeriod"));
policy.setPreferredBackupTime(jsonObj.getString("PreferredBackupTime"));
return policy;
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Transactional(propagation = Propagation.NOT_SUPPORTED)
public void deployFromLog(DynamicFormDeployLogEntity logEntity) {
DynamicFormColumnBindEntity entity = JSON.parseObject(logEntity.getMetaData(), DynamicFormColumnBindEntity.class);
DynamicFormEntity form = entity.getForm();
List<DynamicFormColumnEntity> columns = entity.getColumns();
if (logger.isDebugEnabled()) {
logger.debug("do deploy form {} , columns size:{}", form.getName(), columns.size());
}
deploy(form, columns, !(loadOnlyTags != null && Arrays.asList(loadOnlyTags).contains(entity.getForm().getTags())));
}
代码示例来源:origin: alibaba/fastjson
@Override
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
// parse byte[] or String payload to Java Object
Object payload = message.getPayload();
Object obj = null;
if (payload instanceof byte[]) {
obj = JSON.parseObject((byte[]) payload, 0, ((byte[]) payload).length,
fastJsonConfig.getCharset(), targetClass, fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(), JSON.DEFAULT_PARSER_FEATURE, fastJsonConfig.getFeatures());
} else if (payload instanceof String) {
obj = JSON.parseObject((String) payload, targetClass, fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(), JSON.DEFAULT_PARSER_FEATURE, fastJsonConfig.getFeatures());
}
return obj;
}
代码示例来源:origin: alibaba/fastjson
public T convert(ResponseBody value) throws IOException {
try {
return JSON.parseObject(value.bytes()
, fastJsonConfig.getCharset()
, type
, fastJsonConfig.getParserConfig()
, fastJsonConfig.getParseProcess()
, JSON.DEFAULT_PARSER_FEATURE
, fastJsonConfig.getFeatures()
);
} catch (Exception e) {
throw new IOException("JSON parse error: " + e.getMessage(), e);
} finally {
value.close();
}
}
}
代码示例来源:origin: alibaba/fastjson
@Override
public T deserialize(byte[] bytes) throws SerializationException {
if (bytes == null || bytes.length == 0) {
return null;
}
try {
return (T) JSON.parseObject(
bytes,
fastJsonConfig.getCharset(),
type,
fastJsonConfig.getParserConfig(),
fastJsonConfig.getParseProcess(),
JSON.DEFAULT_PARSER_FEATURE,
fastJsonConfig.getFeatures()
);
} catch (Exception ex) {
throw new SerializationException("Could not deserialize: " + ex.getMessage(), ex);
}
}
}
代码示例来源:origin: hs-web/hsweb-framework
@Override
public AuthenticationBuilder json(String json) {
JSONObject jsonObject = JSON.parseObject(json);
user(jsonObject.getObject("user", SimpleUser.class));
role(jsonObject.getJSONArray("roles").toJSONString());
permission(jsonObject.getJSONArray("permissions").toJSONString());
return this;
}
内容来源于网络,如有侵权,请联系作者删除!