X Tutup
Skip to content

Handling of null-values in JSONObject and XML.toString() #429

@tobihein

Description

@tobihein

We have a json-string and want to convert it to a corresponding xml-string. In case, that there are null-values in the json-string, we get an unexpected result

JSon-String

{
   "myKey": null
}

What we do

String jsonString="{\"myKey\": null}";
final JSONObject jsonObject = new JSONObject( jsonString );
finalString xmlString = XML.toString( jsonObject));

What we get
<myKey>null</myKey>

What we expect
<myKey/>

Is our expectation correct? If yes, I would do a pull-request and change line 594 in class XML.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup