Git Product home page Git Product logo

Comments (7)

rowstop avatar rowstop commented on June 5, 2024

这个 usingName 是指 Enum.name()

from fastjson2.

ganweiming avatar ganweiming commented on June 5, 2024

这个 usingName 是指 Enum.name()

但是WriteEnumsUsingName在jdk 1.8中会使用@JSONField中的name属性输出

from fastjson2.

rowstop avatar rowstop commented on June 5, 2024

这个 usingName 是指 Enum.name()

但是WriteEnumsUsingName在jdk 1.8中会使用@JSONField中的name属性输出

🤔表现不一致?这是个问题

from fastjson2.

ganweiming avatar ganweiming commented on June 5, 2024

这个 usingName 是指 Enum.name()

但是WriteEnumsUsingName在jdk 1.8中会使用@JSONField中的name属性输出

🤔表现不一致?这是个问题

是的, 表现不一致才提出的issue

from fastjson2.

wenshao avatar wenshao commented on June 5, 2024
  @Test
    fun test() {
        var str = JSON.toJSONString(Type.ACCEPTED, JSONWriter.Feature.WriteEnumsUsingName)
        assertEquals("\"Accepted\"", str)
        assertEquals(Type.ACCEPTED, JSON.parseObject(str, Type::class.java))
    }

    enum class Type {
        @JSONField(name = "Accepted")
        ACCEPTED,
        @JSONField(name = "Pending")
        PENDING,
        @JSONField(name = "Rejected")
        REJECTED
    }

问题没有重现啊

from fastjson2.

ganweiming avatar ganweiming commented on June 5, 2024
var str = JSON.toJSONString(Type.ACCEPTED, JSONWriter.Feature.WriteEnumsUsingName)

jdk 17以上的版本打印输出的为"ACCEPTED", 预期输出为"Accepted"

from fastjson2.

wenshao avatar wenshao commented on June 5, 2024

我测试过JDK 17也是对的啊

from fastjson2.

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.