OpenMined/KotlinSyft

Invalid JSON at 31: Encountered an unknown key type

Closed this issue · 5 comments

Description

JSON format mismatch

How to Reproduce

  1. after finishing one round when reporting diffs to the server
  2. See error

Expected Behavior

Diffs should be reported to the server, and receive a success message

Screenshots

If applicable, add screenshots to help explain your problem.
image

System Information

  • OS: Windows 10
  • OS Version: Education 10
  • Language Version: [Python 3.7, Node 10.18.1]
  • Package Manager Version: [Conda 4.6.1, NPM 6.14.1]
  • Browser (if applicable): Google Chrome]
  • Browser Version (if applicable): [81.0.4044.138]

Additional Context

Error may be caused by JSON format mismatch caused by the ReportDataModels and CycleDataModels.

Hi @yuechaor,
We'll take a look to this. Thanks.

Which PyGrid version are you using? @yuechaor

I used the suggested commit, followed this instruction:
git checkout 0e93aa645a63a02f45ae72b4ff3106c6402dbadf

Hi @yuechaor, for some reasons ReportResponseSerializer has issues in parsing. You need to manually parse the response and return as follows:

return if (!response.getObject("data").getPrimitive("status").content.isNullOrEmpty())
                        json.parse(
                                ReportResponseData.ReportSuccess.serializer(),
                                response.getObject("data").toString()
                        )
                else
                        json.parse(ReportResponseData.ReportError.serializer(), data.toString())

Hi @yuechaor, for some reasons ReportResponseSerializer has issues in parsing. You need to manually parse the response and return as follows:

return if (!response.getObject("data").getPrimitive("status").content.isNullOrEmpty())
                        json.parse(
                                ReportResponseData.ReportSuccess.serializer(),
                                response.getObject("data").toString()
                        )
                else
                        json.parse(ReportResponseData.ReportError.serializer(), data.toString())

@mustansarsaeed thanks for sharing it