jaguar_serializer icon indicating copy to clipboard operation
jaguar_serializer copied to clipboard

Response as map of map support

Open jaumard opened this issue 5 years ago • 3 comments

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 ?

jaumard avatar Sep 10 '18 06:09 jaumard

Can you post what is generated for getInventory.

tejainece avatar Sep 10 '18 07:09 tejainece

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 avatar Sep 10 '18 07:09 jaumard

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

jaumard avatar Sep 10 '18 18:09 jaumard