Skip to content
This repository was archived by the owner on Oct 23, 2020. It is now read-only.
This repository was archived by the owner on Oct 23, 2020. It is now read-only.

Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 - When posting new Statement #32

@venkatapathy

Description

@venkatapathy

Guys,

I am trying to use jxapi with OpenLrs- which is an open source LRS written in Java. So when I try to Post a single statement (or multiple statements for that matter), it returns Json response as Jsonarray. For eg:
For a post statement below:

{
  "actor": {
    "name": "Sally Glider",
    "mbox": "mailto:[email protected]"
  },
  "verb": {
    "id": "http://adlnet.gov/expapi/verbs/experienced",
    "display": { "en-US": "experienced" }
  },
  "object": {
    "id": "http://example.com/activities/solo-hang-gliding",
    "definition": {
      "name": { "en-US": "Solo Hang Gliding" }
    }
  }
}

OpenLrs' response is:

[
  "c250f7a5-859b-4080-a8cb-0972fa76b25d"
]

Now this throws an error:
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2

in the class-StatementClient in the function:

public String postStatement(Statement statement)

at line:
JsonArray jsonResult = gson.fromJson(result, JsonArray.class);

I even tried to convert the response to Jsonarray at the source- Openlrs before returning, but it still throws the same error.

Could someone tell me what's the expected response? In the specification, there is no hint given except that it says the POST should return an array of id, which as I see it, the Openlrs does follow suit? Could anyone please help me? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions