0

using XML.toJSONObject(xml)

<root>
<dependencies>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>LATEST</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>LATEST</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>LATEST</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>LATEST</version>
</dependency>
</dependencies>
</root>

and result is

{"root":{"dependencies":[{"dependency":[{"groupId":"com.fasterxml.jackson.core","artifactId":"jackson-annotations","version":"LATEST"},{"groupId":"com.fasterxml.jackson.core","artifactId":"jackson-core","version":"LATEST"},{"groupId":"com.fasterxml.jackson.core","artifactId":"jackson-databind","version":"LATEST"}]},{"dependency":{"groupId":"com.fasterxml.jackson.core","artifactId":"jackson-annotations","version":"LATEST"}}]}}

at dependencies[0] dependency will converted in array i.e. [OK]

but at dependencies[1] dependency will converted in object i.e. create problem to parse with jackson in pojo class.

Rohit
  • 3,401
  • 4
  • 33
  • 60

0 Answers0