Giter Club home page Giter Club logo

Comments (11)

javadev avatar javadev commented on April 28, 2024 1

@dejavuhuh I added new mode REPLACE_EMPTY_STRING_WITH_EMPTY_VALUE to the U.jsonToXml(json) method.

from underscore-java.

javadev avatar javadev commented on April 28, 2024

Hello @dejavuhuh,

Thank you for improvement suggestion.

from underscore-java.

dejavuhuh avatar dejavuhuh commented on April 28, 2024

Hello @dejavuhuh,

Thank you for improvement suggestion.

Hello @javadev,
Thank you for replying to me, and I suddenly remembered some situations like:

// replace <aaa></aaa> to "aaa": null
U.xmlToJson(xml, U.Mode.REPLACE_EMPTY_TAG_WITH_NULL);
// and so on...

Last of the last, there will be 8 situations:

// replace <aaa></aaa> to "aaa": null
// replace <aaa></aaa> to "aaa": ""
// replace <aaa /> to "aaa": null
// replace <aaa /> to "aaa": ""

and reversely

// replace "aaa": null to <aaa></aaa>
// replace "aaa": "" to <aaa></aaa>
// replace "aaa": null to <aaa />
// replace "aaa": "" to <aaa />

from underscore-java.

javadev avatar javadev commented on April 28, 2024

I added two new modes for the U.xmlToJson(xml): REPLACE_EMPTY_TAG_WITH_NULL and REPLACE_EMPTY_TAG_WITH_EMPTY_STRING.

For U.jsonToXml(json) we have a mode: REPLACE_NULL_WITH_EMPTY_VALUE

from underscore-java.

dejavuhuh avatar dejavuhuh commented on April 28, 2024

I added two new modes for the U.xmlToJson(xml): REPLACE_EMPTY_TAG_WITH_NULL and REPLACE_EMPTY_TAG_WITH_EMPTY_STRING.

For U.jsonToXml(json) we have a mode: REPLACE_NULL_WITH_EMPTY_VALUE

Thanks, but I would like a mode for replacing { "aaa": "" } to <aaa></aaa> instead of <aaa string="true"/>
like

String xml = U.jsonToXml("{ \"aaa\": \"\" }", U.Mode.REPLACE_EMPTY_STRING_WITH_EMPTY_TAG);
System.out.println(xml); // <aaa></aaa>

from underscore-java.

dejavuhuh avatar dejavuhuh commented on April 28, 2024

@dejavuhuh I added new mode REPLACE_EMPTY_STRING_WITH_EMPTY_VALUE to the U.jsonToXml(json) method.

Thanks very much!

from underscore-java.

javadev avatar javadev commented on April 28, 2024

The new version was released today. 🎉

from underscore-java.

dejavuhuh avatar dejavuhuh commented on April 28, 2024

Hello @dejavuhuh,

Thank you for improvement suggestion.

@javadev Hey, I am glad to see that you just released a new version a week ago, but it seems that multiple U.Mode still not supported?

from underscore-java.

javadev avatar javadev commented on April 28, 2024

Hello @dejavuhuh,

I added two new modes for xmlToJson method.

What other modes do you need?

from underscore-java.

dejavuhuh avatar dejavuhuh commented on April 28, 2024

Hello @dejavuhuh,

I added two new modes for xmlToJson method.

What other modes do you need?

Like this, which can replace self closing with null and also replace empty value with null

String json = U.xmlToJson(xml, U.Mode.REPLACE_SELF_CLOSING_WITH_NULL, U.Mode.REPLACE_EMPTY_VALUE_WITH_NULL);

I can pass two or more U.Mode into the xmlToJson (or jsonToXml) method

from underscore-java.

javadev avatar javadev commented on April 28, 2024

Hi @dejavuhuh,

The new mode REPLACE_EMPTY_TAG_WITH_NULL
replaces emply tag and self closing tag with null.

from underscore-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.