hiranthaR / Json-to-Dart-Model

Json to Dart Model extension can convert JSON objects into Dart data classes. It supports pure Dart class conversion, Flutter-recommended JSON serialization using annotations, Freezed support, Effective Dart:Style, and many more features. Currently, it has more than 135,000 installs.
https://marketplace.visualstudio.com/items?itemName=hirantha.json-to-dart
MIT License
93 stars 18 forks source link

Object Is Not Interable #7

Closed jaredbaszler closed 3 years ago

jaredbaszler commented 3 years ago

When running on a full JSON file with multiple object types and arrays, I get the following error:

image

Things work fine if I highlight tour and season and do them by themselves. What is really odd though it when I highlight the tournaments JSON object, it works and handles all the children objects just fine like venue, courses, etc.

I'm also getting another error "File System Provider for .... is not available:

image

but I also get that error when I highlight the individual objects and things parse correctly so not sure if that is impacting the above error or not.

To Reproduce Steps to reproduce the behavior:

  1. Parse the below JSON

Expected behavior For all objects to get created without error.

Version v2.4.1

Json

{
    "tour": {
        "id": "b52068af-28e4-4e91-bdbb-037591b0ff84",
        "alias": "pga",
        "name": "PGA Tour"
    },
    "season": {
        "id": "83eb0a3a-dd69-40d3-a9ba-f49e398fdb61",
        "year": 2020
    },
    "tournaments": [{
        "id": "97b4fe0b-a804-418e-91c3-165ef91f4eb6",
        "name": "A Military Tribute at The Greenbrier",
        "event_type": "stroke",
        "purse": 7500000.0,
        "winning_share": 1350000.0,
        "currency": "USD",
        "points": 500,
        "start_date": "2019-09-12",
        "end_date": "2019-09-15",
        "course_timezone": "America/New_York",
        "venue": {
            "id": "5aa3b467-b61b-4b22-bc58-64c2cc13a2a9",
            "name": "The Greenbrier",
            "city": "White Sulphur Springs",
            "state": "WV",
            "zipcode": "24986",
            "country": "USA",
            "courses": [{
                "id": "2e9d8873-0317-42a4-b734-a86438717c41",
                "name": "The Old White",
                "yardage": 7274,
                "par": 70,
                "holes": [{
                    "number": 1,
                    "par": 4,
                    "yardage": 449
                }, {
                    "number": 2,
                    "par": 4,
                    "yardage": 488
                }, {
                    "number": 3,
                    "par": 3,
                    "yardage": 205
                }, {
                    "number": 4,
                    "par": 4,
                    "yardage": 427
                }, {
                    "number": 5,
                    "par": 4,
                    "yardage": 388
                }, {
                    "number": 6,
                    "par": 4,
                    "yardage": 471
                }, {
                    "number": 7,
                    "par": 4,
                    "yardage": 430
                }, {
                    "number": 8,
                    "par": 3,
                    "yardage": 234
                }, {
                    "number": 9,
                    "par": 4,
                    "yardage": 404
                }, {
                    "number": 10,
                    "par": 4,
                    "yardage": 385
                }, {
                    "number": 11,
                    "par": 4,
                    "yardage": 493
                }, {
                    "number": 12,
                    "par": 5,
                    "yardage": 568
                }, {
                    "number": 13,
                    "par": 4,
                    "yardage": 492
                }, {
                    "number": 14,
                    "par": 4,
                    "yardage": 401
                }, {
                    "number": 15,
                    "par": 3,
                    "yardage": 217
                }, {
                    "number": 16,
                    "par": 4,
                    "yardage": 444
                }, {
                    "number": 17,
                    "par": 5,
                    "yardage": 616
                }, {
                    "number": 18,
                    "par": 3,
                    "yardage": 162
                }]
            }]
        }
    }, {
        "id": "f0d98951-e0c1-4e70-aace-bd2c76304e08",
        "name": "Sanderson Farms Championship",
        "event_type": "stroke",
        "purse": 6600000.0,
        "winning_share": 1188000.0,
        "currency": "USD",
        "points": 500,
        "start_date": "2019-09-19",
        "end_date": "2019-09-22",
        "course_timezone": "America/Chicago",
        "venue": {
            "id": "3d7993d0-7448-4670-b793-f7d7dfe03ed1",
            "name": "Country Club of Jackson",
            "city": "Jackson",
            "state": "MS",
            "zipcode": "39211",
            "country": "USA",
            "courses": [{
                "id": "75b8bafb-081b-4993-b27a-341771e34f47",
                "name": "Country Club of Jackson",
                "yardage": 7354,
                "par": 72,
                "holes": [{
                    "number": 1,
                    "par": 4,
                    "yardage": 411
                }, {
                    "number": 2,
                    "par": 4,
                    "yardage": 418
                }, {
                    "number": 3,
                    "par": 5,
                    "yardage": 571
                }, {
                    "number": 4,
                    "par": 3,
                    "yardage": 181
                }, {
                    "number": 5,
                    "par": 5,
                    "yardage": 612
                }, {
                    "number": 6,
                    "par": 4,
                    "yardage": 482
                }, {
                    "number": 7,
                    "par": 3,
                    "yardage": 214
                }, {
                    "number": 8,
                    "par": 4,
                    "yardage": 403
                }, {
                    "number": 9,
                    "par": 4,
                    "yardage": 421
                }, {
                    "number": 10,
                    "par": 3,
                    "yardage": 223
                }, {
                    "number": 11,
                    "par": 5,
                    "yardage": 554
                }, {
                    "number": 12,
                    "par": 4,
                    "yardage": 409
                }, {
                    "number": 13,
                    "par": 3,
                    "yardage": 151
                }, {
                    "number": 14,
                    "par": 5,
                    "yardage": 584
                }, {
                    "number": 15,
                    "par": 4,
                    "yardage": 330
                }, {
                    "number": 16,
                    "par": 4,
                    "yardage": 469
                }, {
                    "number": 17,
                    "par": 4,
                    "yardage": 416
                }, {
                    "number": 18,
                    "par": 4,
                    "yardage": 505
                }]
            }]
        }
    }]
}
hiranthaR commented 3 years ago

@jaredbaszler I will check this as soon as possible :slightly_smiling_face: I am bit busy these days with my intership

hiranthaR commented 3 years ago

File System Provider for .... is not a error. its warning something like that. I think you will get this in every conversion right? There was a problem with the Windows OS FIle path. Users can give models folder him self to the extension. In linux, Its works fine. In Windows file path address like this C:\users\ but path read by the extension is like this C:/users/ so vs code APIs can't open folder pick window.this is the warning. So I added temporory /lib as the models location. see #6

iamarjun commented 3 years ago

Getting the same error all of a sudden, used to work flawlessly earlier. @hiranthaR same issue on OSX as well.

jaredbaszler commented 3 years ago

Any progress on this?

iamarnas commented 3 years ago

Hi! @iamarjun , @jaredbaszler

I have fixed this bug . Can you test and accept that it meets your needs in the higher version > 2.5.0. Need to wait to @hiranthaR will update it. And of course test new methods :)