Jaguar-dart / jaguar_serializer

Format (JSON, XML, protobuf, mongodb, etc) and platform (server, client) agnostic serialization framework
172 stars 34 forks source link

Response as map of map support #155

Open jaumard opened 5 years ago

jaumard commented 5 years ago

In the swagger codegen I'm doing, the swagger api has something like:

Future<Map<String, int>> getInventory();

My problem is how Jaguar serializer can parse the string response to this ?

tejainece commented 5 years ago

Can you post what is generated for getInventory.

jaumard commented 5 years ago

Just tried only serializer involve like this and was able to reproduce

import 'package:jaguar_serializer/jaguar_serializer.dart';

void main() {
  final data = '{"sold":17,"placed":1,"string":1139,"Operated":4,"NOT available":1,"123456":1,"Nonavailable":1,"pending":14,"Not-Operated":10,"available":854,"For sale":1,"Offline":1}';

  final repo = JsonRepo();

  Map<String, int> parsedData = repo.from(data);

  print(parsedData);
}
jaumard commented 5 years ago

So now Map<String, int> can be parsed without problem thanks @tejainece ! Let's keep this issue to manage Map<String, Map<String, ...>> :)