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

Changes NULL handling in XML output #430

Closed
wants to merge 3 commits into from

Conversation

johnjaylward
Copy link
Contributor

@johnjaylward johnjaylward commented Aug 3, 2018

What problem does this code solve?
Adjusts null handling in XML output in reference to #429.

Risks
Due to the change in null handling, release notes should be updated to reflect the change in behavior. Previously, { "key": null } would output to <key>null</key>. It will now output to <key/>. Also, empty string values "" would output to <key/>, but will now output to <key></key>.

Changes to the API?
None.

Will this require a new release?
Yes

Should the documentation be updated?
Yes

Does it break the unit tests?
Yes. New unit test are provided in a separate PR (stleary/JSON-Java-unit-test#87)

Was any code refactored in this commit?
no

Review status
NOT REVIEWED

johnjaylward and others added 3 commits August 3, 2018 15:16
fixes stleary#429.

Updates JSON-> XML conversion to treat all NULL types the same. Previously a JSONObject having a key with a JSONObject.NULL value would output `<key>null</key>`. However, a JSONObject having a key with a value of JAVA `null` would output as `<key />`.

This change unifies the output so both now output as `<key />`.
@stleary
Copy link
Owner

stleary commented Aug 4, 2018

We have leeway for XML changes because of the imperfect nature of the XML / JSON transform. Does this change also fix a bug in the JSONML implementation? If so, is the bug so serious that it justifies changing existing behavior? Is there a way to implement the change such that it does not impact JSONML?

@johnjaylward
Copy link
Contributor Author

I'll take a look. At the moment work is pretty busy, but I'll try to get to this in the next week or so.

@stleary
Copy link
Owner

stleary commented Aug 13, 2018

Thanks!

@tobihein
Copy link

I would like to have a look at it, too. But I don't understand this comment:

Does this change also fix a bug in the JSONML implementation? If so, is the bug so serious that it justifies changing existing behavior? Is there a way to implement the change such that it does not impact JSONML

What is the bug in the JSONML? Why should it not be fixed?

@johnjaylward
Copy link
Contributor Author

I'm not sure I'd label it a bug per-say... before this PR, the 2 different tag types would generate empty strings:

<root>
<Tag1 />
<Tag2></Tag2>
<root>

The JSONML would generate JSON that indicated Tag1 and Tag2 are empty strings.

After the change, JSONML would indicate that Tag1 is null, and Tag2 is an empty string.

I still need to check the JSONML spec to verify if that is a proper interpretation.

@stleary
Copy link
Owner

stleary commented Dec 9, 2018

JSONML behavior should not be changed, or a case made as to why it is currently incorrect.

@stleary stleary closed this Dec 9, 2018
@johnjaylward johnjaylward deleted the patch-1 branch May 22, 2020 18:25
@kmnalluri
Copy link

What happened to these changes? I don't see any of them in the latest releases.

@johnjaylward
Copy link
Contributor Author

they were abandoned as I did not have time to validate the JSONML portions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants