Static factory method to build a JSON Patch out of a JSON representation.

@param node the JSON representation of the generated JSON Patch
@return a JSON Patch
@throws IOException input is not a valid JSON patch
@throws NullPointerException input is null
193695
public static JsonPatch fromJson(final JsonNode node) throws IOException {
        requireNonNull(node, "node");
        try {
            return Jackson.treeToValue(node, JsonPatch.class);
        } catch (JsonMappingException e) {
            throw new JsonPatchException("invalid JSON patch", e);
        }
    }
1159305
private ObjectJS jsonTreeNode(CallTreeNode node, StringifierFactory jsonStringifierFactory) {
		final ObjectJS nodeJS = ObjectJS.create(node, jsonStringifierFactory);
		if (!node.getChildren().isEmpty()) {
			final ArrayJS childNodesJS=new ArrayJS(node.getChildren().size());
			for(CallTreeNode childNode:node.getChildren()) {
				childNodesJS.addElement(jsonTreeNode(childNode, jsonStringifierFactory));
			}
			nodeJS.setAttribute("children", childNodesJS);
		}
		return nodeJS;
	}
119224
private Node createNode(String nodeName, JsonObject jsonNode, String urlPropName) throws NetworkConfigurationException {

//        jsonNode.
//        if (jsonNode.isNull(urlPropName)) {
//            return  null;
//        }

        String url = jsonNode.getString(urlPropName, null);
        if (url == null) {
            return null;
        }

        Properties props = extractProperties(jsonNode, "grpcOptions");

        if (null != props) {
            String value = props.getProperty("grpc.keepalive_time_ms");
            if (null != value) {
                props.remove("grpc.keepalive_time_ms");
                props.put("grpc.NettyChannelBuilderOption.keepAliveTime", new Object[] {new Long(value), TimeUnit.MILLISECONDS});
            }

            value = props.getProperty("grpc.keepalive_timeout_ms");
            if (null != value) {
                props.remove("grpc.keepalive_timeout_ms");
                props.put("grpc.NettyChannelBuilderOption.keepAliveTimeout", new Object[] {new Long(value), TimeUnit.MILLISECONDS});
            }
        }

        // Extract the pem details
        getTLSCerts(nodeName, jsonNode, props);

        return new Node(nodeName, url, props, jsonNode);
    }
448645
public static org.jdom2.Element convert(org.w3c.dom.Element node)
	{
		if (node == null)
			return null; // Convert null->null

		DOMBuilder builder = new DOMBuilder();

		return builder.build(node);
	}
831082
@Override
    public JsonNode visit(JmesPathField fieldNode, JsonNode input) {
        if (input.isObject()) {
            //TODO : CamelCase will need to change at some point
            return input.get(CamelCaseUtils.toCamelCase(fieldNode.getValue()));
        }
        return NullNode.getInstance();
    }
1183583
public static JsonNode readJson(InputStream source, ClassLoader classLoader) {
        return SerializationUtils.readJson(source, classLoader);
    }
896395
private static final String getKey(ObjectNode node) {
        JsonNode apiVersion = node.get(API_VERSION);
        JsonNode kind = node.get(KIND);

        return getKey(apiVersion != null ? apiVersion.textValue() : null,
                      kind != null ? kind.textValue() : null);
    }
59148
public static Config fromJSON(URL url) throws IOException {
        ConfigSupport support = new ConfigSupport();
        return support.fromJSON(url, Config.class);
    }
686293
private static ArrayNode toJson(Iterable<? extends Change<?>> changes) {
        final ArrayNode changesNode = JsonNodeFactory.instance.arrayNode();
        changes.forEach(c -> {
            final ObjectNode changeNode = JsonNodeFactory.instance.objectNode();
            changeNode.put("path", c.path());
            changeNode.put("type", c.type().name());
            final Class<?> contentType = c.type().contentType();
            if (contentType == JsonNode.class) {
                changeNode.set("content", (JsonNode) c.content());
            } else if (contentType == String.class) {
                changeNode.put("content", (String) c.content());
            }
            changesNode.add(changeNode);
        });
        return changesNode;
    }
38878
public static String stringify(final JsonNode json) {
        try {
            return json != null ? createObjectMapper().writeValueAsString(json) : "{}";
        } catch (JsonProcessingException jpx) {
            throw new RuntimeException("A problem occurred while stringifying a JsonNode: " + jpx.getMessage(), jpx);
        }
    }
837371
@SuppressWarnings("rawtypes")
    private static Object createIntermediate(JsonNode node, StringBuffer pathSofar, String index,
            String nextIndex) {
        if (node instanceof POJONode) {
            return createIntermediate(extractValue((POJONode) node), pathSofar, index, nextIndex);
        }
        if (node instanceof ContainerNode) {
            ContainerNode temp = (ContainerNode) node;
            JsonNode value = PATTERN_INDEX.matcher(nextIndex).matches() ? temp.arrayNode()
                    : temp.objectNode();
            return createIntermediate(temp, pathSofar, index, value);
        }
        return null;
    }
497888
public Document fromJsoup(org.jsoup.nodes.Document in) {
        Validate.notNull(in);
        DocumentBuilder builder;
        try {
        	//set the factory to be namespace-aware
        	factory.setNamespaceAware(true);
            builder = factory.newDocumentBuilder();
            Document out = builder.newDocument();
            convert(in, out);
            return out;
        } catch (ParserConfigurationException e) {
            throw new IllegalStateException(e);
        }
    }
1306560
private JSONObject jsonFromElement(final AtlasElement element) throws JSONException {
        final ObjectNode objectNode = this.objectNodeFromElement(element);

        try {
            return new JSONObject(new JSONTokener(MAPPER.writeValueAsString(objectNode)));
        } catch (IOException ioe) {
            // repackage this as a JSONException...seems sensible as the caller will only know about
            // the jettison object not being created
            throw new JSONException(ioe);
        }
    }
1229562
public static BoxEntity createEntityFromJson(final JsonObject json){
        JsonValue typeValue = json.get(BoxEntity.FIELD_TYPE);
        if (!typeValue.isString()) {
            return null;
        }
        String type = typeValue.asString();
        BoxEntityCreator creator = ENTITY_ADDON_MAP.get(type);
        BoxEntity entity = null;
        if (creator == null){
            entity = new BoxEntity();
        } else {
            entity = creator.createEntity();
        }
        entity.createFromJson(json);
        return entity;
    }
1003005
public static RedissonNodeConfig fromJSON(File file) throws IOException {
        ConfigSupport support = new ConfigSupport();
        return support.fromJSON(file, RedissonNodeConfig.class);
    }
729453
public static Map<String, Object> xmlToMap(Node node) {
		return xmlToMap(node, new HashMap<String, Object>());
	}
1231241
protected final JsonNode getRequiredNode(JsonNode tree, String fieldName) {
		Assert.notNull(tree, "Tree must not be null");
		JsonNode node = tree.get(fieldName);
		Assert.state(node != null && !(node instanceof NullNode),
				() -> "Missing JSON field '" + fieldName + "'");
		return node;
	}