question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Retaining the mandatory <root> during jsontoxml conversion

See original GitHub issue

Hi,

Is this possible to always retain the root irrespective of how the JSON is, in the final XML?

Regards, Malaya

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
javadevcommented, Oct 1, 2021

The new version was released today 🎉

1reaction
javadevcommented, Sep 29, 2021

I will add a newRootName support for this case.

        assertEquals(
                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                        + "<newroot>\n"
                        + "  <data array=\"true\">\n"
                        + "    <a>b</a>\n"
                        + "  </data>\n"
                        + "</newroot>",
                U.jsonToXml(
                        "{\n"
                                + "  \"data\": [\n"
                                + "    {\n"
                                + "      \"a\": \"b\"\n"
                                + "    }\n"
                                + "  ]\n"
                                + "}",
                        U.Mode.FORCE_ADD_ROOT_JSON_TO_XML, "newroot"));
Read more comments on GitHub >

github_iconTop Results From Across the Web

Difficulty in Conversion of JSON to XML - Forums
We are working on a generalized solution of converting a JSON message to XML message using the below statement SET OutputRoot.XMLNSC =InputRoot.JSON.Data;.
Read more >
How to Convert JSON to XML in java whilst keeping same ...
I downloaded the Official JSON-java repository and changed \src\main\java\org\json\JSONObject.java constructor from
Read more >
Azure API Management transformation policies
In this article. Transformation policies; Convert JSON to XML; Convert XML to JSON; Find and replace string in body ...
Read more >
XMLtoJSON policy | Apigee Edge
This element is mandatory when the variable defined in the <Source> element is of type string. Type, message. <Options>. Options give you control...
Read more >
How to Convert JSON to XML SOAP and Back
Defines XML sequences that specify the order of XML elements in the plugin configuration. This is required since JSON does not enforce ordering....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found