本文整理了Java中org.json.simple.JSONObject.toString()
方法的一些代码示例,展示了JSONObject.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSONObject.toString()
方法的具体详情如下:
包路径:org.json.simple.JSONObject
类名称:JSONObject
方法名:toString
暂无
代码示例来源:origin: pentaho/pentaho-kettle
public String getRepository( String name ) {
RepositoryMeta repositoryMeta = repositoriesMeta.findRepository( name );
if ( repositoryMeta != null ) {
currentRepository = repositoryMeta;
return repositoryMeta.toJSONObject().toString();
}
return "";
}
代码示例来源:origin: alibaba/mdrill
obj.put("task", input.getSourceTask());
obj.put("tuple", input.getValues());
sendToSubprocess(obj.toString());
while(true) {
String line = "";
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testToJSONString() {
when( databaseMeta.getName() ).thenReturn( DATABASE_CONNECTION );
kettleDatabaseRepositoryMeta.setName( NAME );
kettleDatabaseRepositoryMeta.setDescription( DESCRIPTION );
kettleDatabaseRepositoryMeta.setConnection( databaseMeta );
kettleDatabaseRepositoryMeta.setDefault( true );
JSONObject json = kettleDatabaseRepositoryMeta.toJSONObject();
assertEquals( JSON_OUTPUT, json.toString() );
}
代码示例来源:origin: pentaho/pentaho-kettle
@Test
public void testToJSONString() {
kettleFileRepositoryMeta.setName( NAME );
kettleFileRepositoryMeta.setHidingHiddenFiles( true );
kettleFileRepositoryMeta.setDescription( DESCRIPTION );
kettleFileRepositoryMeta.setBaseDirectory( THIS_IS_THE_PATH );
kettleFileRepositoryMeta.setReadOnly( true );
kettleFileRepositoryMeta.setDefault( true );
JSONObject json = kettleFileRepositoryMeta.toJSONObject();
assertEquals( JSON_OUTPUT, json.toString() );
}
代码示例来源:origin: apache/metron
private byte[] mockGlobalData(){
JSONObject global = new JSONObject();
global.put(TEST_PROPERTY, TEST_VALUE);
return global.toString().getBytes();
}
代码示例来源:origin: apache/tika
if(quantity!=null) {
if (quantity.containsKey("rawValue")) {
String measurementNumber = (String) convertToJSONObject(quantity.toString()).get("rawValue");
measurementString.append(measurementNumber);
measurementString.append(" ");
String normalizedMeasurementNumber = convertToJSONObject(quantity.toString()).get("normalizedQuantity").toString();
normalizedMeasurementString.append(normalizedMeasurementNumber);
normalizedMeasurementString.append(" ");
String measurementType = (String) convertToJSONObject(quantity.toString()).get("type");
measurementTypeSet.add(measurementType);
JSONObject jsonObj = (JSONObject) convertToJSONObject(quantity.toString());
if (jsonObj.containsKey("rawUnit")) {
JSONObject rawUnit = (JSONObject) jsonObj.get("rawUnit");
String unitName = (String) convertToJSONObject(rawUnit.toString()).get("name");
unitSet.add(unitName);
measurementString.append(unitName);
String normalizedUnitName = (String) convertToJSONObject(normalizedUnit.toString()).get("name");
normalizedMeasurementString.append(normalizedUnitName);
代码示例来源:origin: apache/metron
LOG.debug("[Metron] Final normalized message: {}", metronJson.toString());
代码示例来源:origin: jitsi/jitsi-videobridge
sendMessageToEndpoints(jsonObject.toString(), endpointSubset);
代码示例来源:origin: rackerlabs/blueflood
Map<Locator, MetricData> results = getRollupByGranularity(tenantId, locators, params.getRange().getStart(), params.getRange().getStop(), params.getGranularity(tenantId));
JSONObject metrics = serializer.transformRollupData(results, params.getStats());
final JsonElement element = parser.parse(metrics.toString());
final String jsonStringRep = gson.toJson(element);
sendResponse(ctx, request, jsonStringRep, HttpResponseStatus.OK);
代码示例来源:origin: sakaiproject/sakai
/**
* Return a string
*/
public String toString()
{
return contentItem.toString();
}
代码示例来源:origin: sakaiproject/sakai
/**
* Return a string
*/
public String toString()
{
return body.toString();
}
代码示例来源:origin: sakaiproject/sakai
/**
* Return a string
*/
public String toString()
{
return toolProxy.toString();
}
代码示例来源:origin: com.adobe.ride/ride-model-util
/**
* @param obj JSONObject with unexpected definition
*/
public UnexpectedModelDefinitionException(JSONObject obj) {
super("Encountered unexpected model definition when loading model: " + obj.toString());
this.targetObject = obj;
}
代码示例来源:origin: rackerlabs/blueflood
final JsonElement element = parser.parse(metricData.toString());
final String jsonStringRep = gson.toJson(element);
sendResponse(ctx, request, jsonStringRep, HttpResponseStatus.OK);
代码示例来源:origin: sakaiproject/sakai
public String toJSON() {
JSONObject obj = new JSONObject();
obj.put("autoFavoritesEnabled", autoFavoritesEnabled);
obj.put("favoriteSiteIds", new ArrayList<String>(favoriteSiteIds));
return obj.toString();
}
代码示例来源:origin: org.alfresco/alfresco-repository
private void postActivity(String siteId, String activityType, JSONObject activityData)
{
if(activityData != null)
{
activityService.postActivity(activityType, siteId, "comments", activityData.toString());
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
protected void reduce(Text key, Iterable<Text> values, Context context) throws IOException, InterruptedException
{
JSONObject accumulatorObject = null;
try {
accumulatorObject = JSONLDUtilSimple.mergeJSONObjects(new TextToStringIterator(values.iterator()));
} catch (ParseException e) {
throw new IOException(e);
}
reusableOutputValue.set(accumulatorObject.toString());
context.write(NullWritable.get(), reusableOutputValue);
}
代码示例来源:origin: org.apache.cassandra/cassandra-all
@Override
public void print(T data, PrintStream out)
{
JSONObject json = new JSONObject();
json.putAll(data.convert2Map());
out.println(json.toString());
}
}
代码示例来源:origin: jsevellec/cassandra-unit
@Override
public void print(T data, PrintStream out)
{
JSONObject json = new JSONObject();
json.putAll(data.convert2Map());
out.println(json.toString());
}
}
代码示例来源:origin: BiglySoftware/BiglyBT
public String toString(){
ItemList list=new ItemList();
Iterator<Map.Entry<String, Object>> iter=entrySet().iterator();
while(iter.hasNext()){
Map.Entry<String, Object> entry=iter.next();
list.add(toString(entry.getKey().toString(),entry.getValue()));
}
return "{"+list.toString()+"}";
}
内容来源于网络,如有侵权,请联系作者删除!