Skip to content

ParseObject.fromJson is not working properly #688

Closed
@hinryd

Description

@hinryd

New Issue Checklist

Issue Description

ParseObject.fromJson function is not sending the proper payload to the server.
This is the exact same bug with #568 and #630.

Steps to reproduce

var map = {
      'firstName': 'Barbie',
      'lastName': 'Lee',
};
ParseObject obj = ParseObject('Models').fromJson(map);
ParseResponse res = await obj.save();

Actual Outcome

As you can see the -d flag does not contain anything:

I/flutter ( 4119): ╭-- Parse Request
I/flutter ( 4119): curl -X POST -H 'content-type: text/plain; charset=utf-8' -H 'user-agent: Flutter Parse SDK 3.1.0' -H 'X-Parse-Application-Id: [redacted]' -H 'X-Parse-Session-Token: [redacted]' -H 'X-Parse-Client-Key: [redacted]' -d '{}' https://parseapi.back4app.com/classes/Models
I/flutter ( 4119):
I/flutter ( 4119):  https://parseapi.back4app.com/classes/Models
I/flutter ( 4119): ╰--

Expected Outcome

Using a forEach loop to set the object value, I can achieve the following:

I/flutter ( 4119): ╭-- Parse Request
I/flutter ( 4119): curl -X POST -H 'content-type: text/plain; charset=utf-8' -H 'user-agent: Flutter Parse SDK 3.1.0' -H 'X-Parse-Application-Id: [redacted]' -H 'X-Parse-Session-Token: [redacted]' -H 'X-Parse-Client-Key: [redacted]' -d '{"firstName":"Barbie","lastName":"Lee"}' https://parseapi.back4app.com/classes/Models
I/flutter ( 4119):
I/flutter ( 4119):  https://parseapi.back4app.com/classes/Models
I/flutter ( 4119): ╰--

Environment

Flutter 2.5.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 3595343e20 (5 weeks ago) • 2021-09-30 12:58:18 -0700
Engine • revision 6ac856380f
Tools • Dart 2.14.3

Parse Flutter SDK

  • SDK version: 3.1.0
  • Operating system version: macOS

Server

  • Parse Server version: back4app

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions