google / json_serializable.dart

Generates utilities to aid in serializing to/from JSON.
https://pub.dev/packages/json_serializable
BSD 3-Clause "New" or "Revised" License
1.55k stars 397 forks source link

root level arrays #648

Open TheDevelolper opened 4 years ago

TheDevelolper commented 4 years ago

Hi there,

I wondered if this library has support for root level arrays? What happens if your JSON http endpoint returns a collection of objects?

I've been struggling to serialise these so if you have any examples I'd really appreciate it.

kevmoo commented 4 years ago

You'll have to wire that up by hand. It's not too hard.

On Fri, May 29, 2020 at 1:18 AM ISimplifyComplexity < notifications@github.com> wrote:

Hi there,

I wondered if this library has support for root level arrays? What happens if your JSON http endpoint returns a collection of objects?

I've been struggling to serialise these so if you have any examples I'd really appreciate it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dart-lang/json_serializable/issues/648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEFCS64WRC6P3OM7O2N3DRT5VWLANCNFSM4NN2PWDQ .

kevmoo commented 4 years ago

See https://stackoverflow.com/questions/50360443/parsing-json-that-has-a-nested-array-of-objects-in-dart/50360708#50360708

TheDevelolper commented 4 years ago

@kevmoo Thank you.

albert0m commented 4 years ago

You'll have to wire that up by hand. It's not too hard.

so that means that the library doesn't support root level arrays?

kevmoo commented 4 years ago

so that means that the library doesn't support root level arrays?

Not – yet. I'm actually working on this now. I'll reopen this issue to track my work.

No promises on timeline, though.

matsp commented 3 years ago

@kevmoo Whats your concept to implement this? Automatic detection via types or configuration in annotations? Any updates - just asking for a friend ;-)

kevmoo commented 3 years ago

It's...tricky. Not high priority for me now.

On Mon, Jul 5, 2021 at 5:37 AM Mats Pfeiffer @.***> wrote:

@kevmoo https://github.com/kevmoo Whats your concept to implement this? Automatic detection via types or configuration in annotations? Any updates

  • just asking for friend ;-)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/json_serializable.dart/issues/648#issuecomment-874079844, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEFCQVBEJSV7Z5PU6Z5DLTWGRQZANCNFSM4NN2PWDQ .