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

[BUG] JPA/EclipseLink doesn't serialize JSON correctly #45

Open
Runi-VN opened this issue Oct 10, 2019 · 2 comments
Open

[BUG] JPA/EclipseLink doesn't serialize JSON correctly #45

Runi-VN opened this issue Oct 10, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@Runi-VN
Copy link
Collaborator

Runi-VN commented Oct 10, 2019

Describe the bug
JPA/EclipseLink serializer ikke JSON i korrekt rækkefølge. (som det står I DTO'en)
To Reproduce

  1. Go to 'https://maltemagnussen.com/CA2/openapi/#/General/getAllPersons'
  2. Swap server to deployment
  3. Click on 'Try it out'
  4. Click on 'Execute'
  5. See erroneous JSON output

Expected behavior
JSON should be serialized/deserialized as they are written in their respective DTO.

As it should be:

{
  "ID": 1,
  "First Name": "Johnny",
  "Last Name": "Reimar",
  "Email": "[email protected]",
  "hobbies": "Test",
  "phones": "Test",
  "Address": "Test"
}  

As it is:

{
    "email": "[email protected]",
    "firstName": "Johnny",
    "hobbies": [],
    "id": 1,
    "lastName": "Reimar",
    "phones": []
  }  

Screenshots

Additional context
We have had this issue before and I remember having it fixed. Was it by using @ElementCollection?

@Runi-VN Runi-VN added the bug Something isn't working label Oct 10, 2019
@Runi-VN
Copy link
Collaborator Author

Runi-VN commented Oct 10, 2019

ALSO

Our empty JSON lists are serialized, it would be much prettier if they weren't! Lets look into this, too.

@MalteMagnussen
Copy link
Owner

Svar fra Lars angående dette fra Slack:
image.png

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

2 participants