Converts a {@link DataModelDto} to JSON string that represents an {@link IDataModel}.
18098
static String toJsonString(final DataModelDto dto) {
        try { return mapper.writeValueAsString(dto); }
        catch (IOException e) { throw new CalculationEngineException(e); }
    }
1026757
static DataModelDto toDataModelDto(final String json) {
        try { return mapper.readValue(json, DataModelDto.class); }
        catch (IOException e) { throw new CalculationEngineException(e); }
    }
310007
public ObjectNode toJson() {
		ObjectMapper mapper = new ObjectMapper();
		ObjectNode node = mapper.createObjectNode();
		ObjectNode unitIntervalNode = mapper.createObjectNode();

		node.put(intervalUnit.getUnitNodeName(), unitIntervalNode);
		unitIntervalNode.put("interval", buildIntervalNode());
		unitIntervalNode.put("aggregationType", intervalUnit.name());

		return node;
	}
358773
private static String toJson(Object x) {
    try {
      if (x == null || x instanceof String || x instanceof Number || x instanceof Character
          || x.getClass().isArray() || x instanceof Iterable<?>) {
        return new JSONObject().put("JSON", x).toString(2);
      } else if (x instanceof Map<?, ?>) {
        return (new JSONObject((Map<?, ?>) x)).toString(2);
      } else if (x instanceof JSONObject) {
        return ((JSONObject) x).toString(2);
      } else {
        return (new JSONObject(x)).toString(2);
      }
    } catch (Exception e) {
      throw new RuntimeException("x=" + x, e);
    }
  }
623952
static List<IDataModel> toDataModels(final InputStream book, final String function) {
        return toDataModels(ConverterUtils.newWorkbook(book), function);
    }
28558
public JSONObject toJSON(ModelView o) throws JSONConverterException {
        ModelViewConverter c = java2json.get(o.getClass());
        if (c == null) {
            throw new JSONConverterException("No converter available for a view with the '" + o.getClass() + "' className");
        }
        return c.toJSON(o);
    }
1369707
public JSONObject getJsonFormatted(Map<String, String> dataMap) {
        JSONObject oneRowJson = new JSONObject();

        for (int i = 0; i < outTemplate.length; i++) {
            oneRowJson.put(outTemplate[i], dataMap.get(outTemplate[i]));
        }


        return oneRowJson;
    }
519152
static OutputStream toXlsxFile(final IDataModel dataModel, final InputStream formatting) {
        ByteArrayOutputStream xlsx = new ByteArrayOutputStream();
        
        try { toWorkbook(dataModel, ConverterUtils.newWorkbook(formatting)).write(xlsx); }
        catch (IOException e) { throw new CalculationEngineException(e); }
        
        return xlsx;
    }
859766
public static String toJsonString(Object object, FieldModifier modifier) throws IllegalAccessException {
        return toJsonString(object, modifier, JsonMethod.AUTO);
    }
270626
public String toDOTString() {
        StringBuilder sb = new StringBuilder();

        // id [label=id: value-type <value-type-attributes>];
        // id -> child_id;
        // id -> child_id;

        sb.append(m_id).append(" [label=\"").append(m_id).append(": ").append(getPlanNodeType()).append("\" ");
        sb.append(getValueTypeDotString());
        sb.append("];\n");
        for (AbstractPlanNode node : m_inlineNodes.values()) {
            sb.append(m_id).append(" -> ").append(node.getPlanNodeId().intValue()).append(";\n");
            sb.append(node.toDOTString());
        }
        for (AbstractPlanNode node : m_children) {
           sb.append(m_id).append(" -> ").append(node.getPlanNodeId().intValue()).append(";\n");
        }

        return sb.toString();
    }
1020085
public JSONObject convertToJson() {
        JSONObject buoJsonModel = new JSONObject();
        try {
            // Add all keys in plane format  initially. All known keys will be replaced with corresponding data type in the following section
            JSONObject metadataJsonObject = metadata_.convertToJson();
            Iterator<String> keys = metadataJsonObject.keys();
            while (keys.hasNext()) {
                String key = keys.next();
                buoJsonModel.put(key, metadataJsonObject.get(key));
            }
            if (!TextUtils.isEmpty(title_)) {
                buoJsonModel.put(Defines.Jsonkey.ContentTitle.getKey(), title_);
            }
            if (!TextUtils.isEmpty(canonicalIdentifier_)) {
                buoJsonModel.put(Defines.Jsonkey.CanonicalIdentifier.getKey(), canonicalIdentifier_);
            }
            if (!TextUtils.isEmpty(canonicalUrl_)) {
                buoJsonModel.put(Defines.Jsonkey.CanonicalUrl.getKey(), canonicalUrl_);
            }
            if (keywords_.size() > 0) {
                JSONArray keyWordJsonArray = new JSONArray();
                for (String keyword : keywords_) {
                    keyWordJsonArray.put(keyword);
                }
                buoJsonModel.put(Defines.Jsonkey.ContentKeyWords.getKey(), keyWordJsonArray);
            }
            if (!TextUtils.isEmpty(description_)) {
                buoJsonModel.put(Defines.Jsonkey.ContentDesc.getKey(), description_);
            }
            if (!TextUtils.isEmpty(imageUrl_)) {
                buoJsonModel.put(Defines.Jsonkey.ContentImgUrl.getKey(), imageUrl_);
            }
            if (expirationInMilliSec_ > 0) {
                buoJsonModel.put(Defines.Jsonkey.ContentExpiryTime.getKey(), expirationInMilliSec_);
            }
            buoJsonModel.put(Defines.Jsonkey.PublicallyIndexable.getKey(), isPublicallyIndexable());
            buoJsonModel.put(Defines.Jsonkey.LocallyIndexable.getKey(), isLocallyIndexable());
            buoJsonModel.put(Defines.Jsonkey.CreationTimestamp.getKey(), creationTimeStamp_);
            
        } catch (JSONException ignore) {
        }
        return buoJsonModel;
    }
1082790
function toJSON(d) {
    if (!_.isString(d)) {
        d = JSON.stringify(d);
    }

    return d;
}
260458
@SuppressWarnings("unchecked")
    private Map<String,Object> jsonifyMBeanInfo(MBeanInfo mBeanInfo) {
        Map<String, Object> result = new LinkedHashMap<>();

        // desc
        result.put("desc", mBeanInfo.getDescription());

        // attr
        Map<String, Object> attrMap = new LinkedHashMap<>();
        result.put("attr", attrMap);
        for (MBeanAttributeInfo attrInfo : mBeanInfo.getAttributes()) {
            if (attrInfo == null) {
                continue;
            }
            Map<String, Object> attr = new HashMap<>();
            attr.put("type", attrInfo.getType());
            attr.put("desc", attrInfo.getDescription());
            attr.put("rw", attrInfo.isWritable() && attrInfo.isReadable());
            attrMap.put(attrInfo.getName(), attr);
        }

        // op
        Map<String, Object> opMap = new LinkedHashMap<>();
        result.put("op", opMap);
        for (MBeanOperationInfo opInfo : mBeanInfo.getOperations()) {
            Map<String, Object> map = new HashMap<>();
            List<Map<String, String>> argList = new ArrayList<>(opInfo.getSignature().length);
            for (MBeanParameterInfo paramInfo : opInfo.getSignature()) {
                Map<String, String> args = new HashMap<>();
                args.put("desc", paramInfo.getDescription());
                args.put("name", paramInfo.getName());
                args.put("type", paramInfo.getType());
                argList.add(args);
            }
            map.put("args", argList);
            map.put("ret", opInfo.getReturnType());
            map.put("desc", opInfo.getDescription());
            Object ops = opMap.get(opInfo.getName());
            if (ops != null) {
                if (ops instanceof List) {
                    // If it is already a list, simply add it to the end
                    ((List) ops).add(map);
                } else if (ops instanceof Map) {
                    // If it is a map, add a list with two elements
                    // (the old one and the new one)
                    List<Object> opList = new LinkedList<>();
                    opList.add(ops);
                    opList.add(map);
                    opMap.put(opInfo.getName(), opList);
                }
            } else {
                // No value set yet, simply add the map as plain value
                opMap.put(opInfo.getName(), map);
            }
        }

        // not
        Map<String, Object> notMap = new LinkedHashMap<>();
        result.put("not", notMap);
        for (MBeanNotificationInfo notInfo : mBeanInfo.getNotifications()) {
            Map<String, Object> map = new HashMap<>();
            map.put("name", notInfo.getName());
            map.put("desc", notInfo.getDescription());
            String[] types = notInfo.getNotifTypes();
            List<String> tList = new ArrayList<>(types.length);
            Collections.addAll(tList, types);
            map.put("types", tList);
            notMap.put(notInfo.getName(), map);
        }

        // this is default - in case we won't find RBACDecorator (possible in hawtio-wildfly for example)
        result.put("canInvoke", true);

        return result;
    }
584784
public static String toJsonString(Object obj, ClassLoader classLoader) {
        if (obj == null) {
            return "null";
        }
        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader != null) {
            Thread.currentThread().setContextClassLoader(classLoader);
        }
        try {
            ObjectMapper mapper = poolMapper.borrowObject();
            if (mapper != null) {
                try {
                    return mapper.writeValueAsString(obj);
                } finally {
                    poolMapper.returnObject(mapper);
                }
            }
            throw new SerializationException("No ObjectMapper instance avaialble!");
        } catch (Exception e) {
            throw e instanceof SerializationException ? (SerializationException) e
                    : new SerializationException(e);
        } finally {
            Thread.currentThread().setContextClassLoader(oldClassLoader);
        }
    }
83266
public String toJSON() {
        JSONBuilder jb = new JSONBuilder(estimateMaximumBytes()).append('{');
        appendParams(jb).append(',');
        appendTables(jb);
        jb.append('}');

        return jb.toString();
    }
10843
public String toJSONString() {
        
        String rawdata = stats.stream().sorted(Comparator.comparingInt(UStats::getIndex))
                .map(sr -> sr.toJSONString())
                .collect(Collectors.joining(",\n    ", "[\n    ", "\n ]"));
        
        String fields = Stream.of(UStats.getJSONFields()).collect(Collectors.joining("\", \"", "[\"", "\"]"));
        
        String models = Stream.of(ScaleDetect.rank(this)).map(me -> me.toJSONString()).collect(Collectors.joining(",\n    ", "[\n    ", "\n  ]"));
        
        return String.format("{ title: \"%s\",\n  nano_tick: %d,\n  models: %s,\n  fields: %s,\n  data: %s\n}",
                title, UUtils.getNanoTick(), models, fields, rawdata);
    }
721582
private DataMediaPairDO modelToDo(DataMediaPair dataMediaPair) {
        DataMediaPairDO dataMediaPairDo = new DataMediaPairDO();
        try {
            dataMediaPairDo.setId(dataMediaPair.getId());
            dataMediaPairDo.setPipelineId(dataMediaPair.getPipelineId());
            dataMediaPairDo.setSourceDataMediaId(dataMediaPair.getSource().getId());
            dataMediaPairDo.setTargetDataMediaId(dataMediaPair.getTarget().getId());
            dataMediaPairDo.setFilter(JsonUtils.marshalToString(dataMediaPair.getFilterData()));
            dataMediaPairDo.setResolver(JsonUtils.marshalToString(dataMediaPair.getResolverData()));
            dataMediaPairDo.setPullWeight(dataMediaPair.getPullWeight());
            dataMediaPairDo.setPushWeight(dataMediaPair.getPushWeight());
            dataMediaPairDo.setColumnPairMode(dataMediaPair.getColumnPairMode());
            dataMediaPairDo.setGmtCreate(dataMediaPair.getGmtCreate());
            dataMediaPairDo.setGmtModified(dataMediaPair.getGmtModified());
        } catch (Exception e) {
            logger.error("ERROR ## change the dataMediaPair Model to Do has an exception", e);
            throw new ManagerException(e);
        }

        return dataMediaPairDo;
    }