Skip to content

Nested Objects #150

Open
Open
@anti43

Description

@anti43

Hi,
Is it possible to deserialize nested Objects?
Given classes

class A{
    String name
}
class B {
   int prop
   A someA
}

and json

[
   {
     "someA": {
          "name": "test1"
      },
    "prop": 2323
   },
   {
     "someA": {
          "name": "test2"
      },
    "prop": 2324
   }
]

is this supposed to work with

Joniterator.parse(json).read(B[].class)

?

I am getting error messages

com.jsoniter.spi.JsonException: readString: expect string or null, but 0, head: 444, peek: cInKmh":
Of course the class and json struct for real is much more complex, but the idea is the same.
What might be wrong here? With gson, it just worked with same json code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions