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

[BUG] Parse decimal point number with suffix B #2769

Closed
Cooper-Zhong opened this issue Jul 2, 2024 · 1 comment
Closed

[BUG] Parse decimal point number with suffix B #2769

Cooper-Zhong opened this issue Jul 2, 2024 · 1 comment
Assignees
Labels
bug Something isn't working fixed
Milestone

Comments

@Cooper-Zhong
Copy link
Contributor

问题描述

类似 #2768, 解析带B后缀的数。

环境信息

  • OS信息: [MacOS 12.7.4 M1 Pro 16 GB]
  • JDK信息: [Openjdk 17.0.6]
  • 版本信息:[Fastjson2 2.0.51]

重现步骤

import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Test;

import java.util.HashMap;


public class Test_1412 {
    @Test
    public void test1() {
        String str = "{\"k1\":123.456,\"k2\":12.34B}";
        HashMap map = (HashMap) JSON.parseObject(str, Object.class);
        Object value = map.get("k2");
        System.out.println(value);
    }

    @Test
    public void test2() {
        String str = "{\"k1\":123.456,\"k2\":12.34B}";
        HashMap map = (HashMap) com.alibaba.fastjson.JSON.parseObject(str, HashMap.class);
        Object value = map.get("k2");
        System.out.println(value);
    }
}

相关日志输出

fastjson 1.x: 12.34
fastjson2 2.0.51: -46

@wenshao
Copy link
Member

wenshao commented Jul 14, 2024

https://github.com/alibaba/fastjson2/releases/tag/2.0.52
问题已修复,请用新版本

@wenshao wenshao closed this as completed Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants