String jsonString = "{\"hello\": \"world\"}"; ModelNode node = ModelNode.fromJSONString(jsonString); System.out.println(node.get("hello").asString()); // prints "world"
String jsonString = "{\"person\":{\"name\":\"John\",\"age\":30}}"; ModelNode node = ModelNode.fromJSONString(jsonString); System.out.println(node.get("person").get("name").asString()); // prints "John" System.out.println(node.get("person").get("age").asInt()); // prints 30This example creates a new ModelNode object from a JSON string with a nested data structure. The get method is used to retrieve values from the nested structure, which are then printed to the console. Overall, the org.jboss.dmr package library provides a powerful way to manipulate and query data in JSON format.