readContentTree method

  1. @override
JsonNode readContentTree(
  1. String content
)
override

Parses the given JSON content string into a JsonNode tree.

This allows you to traverse or inspect JSON data without binding it to a specific object type.

Throws a parsing exception if the content is invalid JSON.

Example

final tree = objectMapper.readContentTree('{"name":"Alice"}');
print(tree.get("name").toObject()); // "Alice"

Implementation

@override
JsonNode readContentTree(String content) {
  final parser = getJsonParser(content);
  final node = readTree(parser);

  parser.close();
  return node;
}