Skip to content

Parsing a complex nested JSON API return to nested custom datatypes does not work #2933

Closed as not planned
@rmrosi

Description

@rmrosi

Has your issue been reported?

  • I have searched the existing issues and confirm it has not been reported.
  • I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.

Current Behavior

I created a datatype "randomUser" from the follwing JSON file:

{
   "results":[
      {
         "gender":"female",
         "name":{
            "title":"Ms",
            "first":"Yvone",
            "last":"Souza"
         },
         "location":{
            "street":{
               "number":700,
               "name":"Rua Dois"
            },
            "city":"Itapecerica da Serra",
            "state":"Roraima",
            "country":"Brazil",
            "postcode":81375,
            "coordinates":{
               "latitude":"62.3948",
               "longitude":"56.7258"
            },
            "timezone":{
               "offset":"+9:30",
               "description":"Adelaide, Darwin"
            }
         },
         "email":"yvone.souza@example.com",
         "login":{
            "uuid":"ffde146d-ce2a-481c-a263-5e27a4f6655b",
            "username":"brownfrog936",
            "password":"helen",
            "salt":"4kOFgWAk",
            "md5":"6f67bc5ebfacb3600ac0f6c3ce36ec29",
            "sha1":"247f93f659ac4a22d1ad9129fc0b770555ee49a1",
            "sha256":"096f8be0395b777c4f5c1da175e590f98d17e9829fe12ad0f49a9b6ae8009c08"
         },
         "dob":{
            "date":"1954-05-02T09:50:26.611Z",
            "age":70
         },
         "registered":{
            "date":"2011-11-02T11:46:45.270Z",
            "age":12
         },
         "phone":"(29) 3333-7623",
         "cell":"(21) 2492-3579",
         "id":{
            "name":"CPF",
            "value":"852.665.599-72"
         },
         "picture":{
            "large":"https://randomuser.me/api/portraits/women/64.jpg",
            "medium":"https://randomuser.me/api/portraits/med/women/64.jpg",
            "thumbnail":"https://randomuser.me/api/portraits/thumb/women/64.jpg"
         },
         "nat":"BR"
      }
   ],
   "info":{
      "seed":"4be31af6a958ac2b",
      "results":1,
      "page":1,
      "version":"1.4"
   }
}

Captura de tela de 2024-05-17 18-17-20

Captura de tela de 2024-05-17 18-18-21

I tried using the Parse as Data Type option in the API Call tab, generating a list of datatypes of type "randomUser" (randomUser), but FlutterFlow is unable to parse automatically from the data returned from the API:

Captura de tela de 2024-05-17 18-13-45

Expected Behavior

Parse automatically from the data returned from the API endpoint.

Steps to Reproduce

  1. Create a new dataype randomUser from JSON file;

Captura de tela de 2024-05-17 18-17-20

  1. Create a new datatype randomUsers from a list of datatype randomUser;

Captura de tela de 2024-05-17 18-18-21

  1. Create a new API endpoint from API base URL: _https://randomuser.me/api/?results=10&nat=br_;
  2. Set the option Parse as Data Type on and choice a datatype randomUsers and mark the checkbox IsList;
  3. Create an App State of type randomUser List;

Captura de tela de 2024-05-17 18-40-25

  1. Create a page with a elements Column and Listview. Call the end point API create in the step 5; in a column element and a dataype in the listview:

Captura de tela de 2024-05-17 21-12-17

Captura de tela de 2024-05-17 21-32-38

  1. The following erro occurs: app state is empty

Captura de tela de 2024-05-17 21-34-10

Reproducible from Blank

  • The steps to reproduce above start from a blank project.

Bug Report Code (Required)

Not convert/parse a JSON to datatype

Context

This issue affect my produtivity. I need to create a custom function and a custom action to do the same action: parse the API JSON response to datatype!

Visual documentation

I inserted the images in the previous fields.

Additional Info

No response

Environment

- FlutterFlow version: v4.1.53+
- Platform: Web
- Browser name and version: EDGE Version 123.0.2420.81 (64 bits)
- Operating system and version affected: Windows 11 and Ubuntu Linux

General

  • I was collaborating with other users in the same project prior to data loss
  • I navigated between different project views leading up to data loss
  • The UI was running very slowly prior to data loss
  • A crash or other bug occurred prior to data loss
  • Data was not saved in a snapshot
  • I was using flutterflow from multiple devices
  • I was using flutterflow from multiple platforms (e.g. both web and MacOS Desktop app)

Relative to the time the changes were made, data was lost within

  • 1 minute
  • 1 hour
  • 1 day
  • 1 week

When following my steps to reproduce, data loss happens

  • ~100% of the time
  • ~50% of the time
  • ~10% of the time
  • ~1% of the time
  • Very rarely or only encountered once

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions