Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter returns stringified array #291

Open
MBuchalik opened this issue Dec 15, 2020 · 4 comments
Open

Adapter returns stringified array #291

MBuchalik opened this issue Dec 15, 2020 · 4 comments
Labels
bug Something isn't working

Comments

@MBuchalik
Copy link
Collaborator

When requesting data using the Adapter, we get a response like this:

{"id":1234,"data":"[{\"column1\":\"first\",\"column2\":\"second\",\"column3\":\"third\"}]"}

Expected result:

The "data" field should be an actual array.

{
  "id":1234,
  "data": [
    {"column1":"first","column2":"second","column3":"third"}
  ]
}

Actual result

The "data" field is currently a string. So you need to run JSON.parse() in order to get the actual data.

@MBuchalik MBuchalik added the bug Something isn't working label Dec 15, 2020
@sonallux
Copy link
Contributor

What exact endpoint are you using?

@MBuchalik
Copy link
Collaborator Author

MBuchalik commented Dec 15, 2020

I am using the "preview" endpoint (api/adapter/preview). But it seems like it also happens with api/adapter/dataImport?includeData=true

@sonallux
Copy link
Contributor

Well, this is currently somehow by design (our internal events use this format too) and also because the Adapter is written in Java. As Java and JPA do not natively support JSON, we are storing the data as String internally, which is not ideal but simple.

Might be worth keeping this in mind when we are discussing #283 in the next meeting.

@mathiaszinnen
Copy link
Contributor

Exactly, we stored the data as a string because this was the simplest solution regarding persistence.
I also think that we should discuss this in the developer meeting.
However, I think we should keep it separate from #283.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants