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

JSONObject.parseObject的时候后,有特殊冒号":"转义失败 #446

Closed
laizhihuan opened this Issue Nov 5, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@laizhihuan

laizhihuan commented Nov 5, 2015

fastjson版本1.1.39

{"amount":1,"channel_id":"wnys01","gem":1,"id":"pay","login_name":"U10722466A","money":1000,"order_id":"99142AO10000086695A","pay_channel":"weilan","pay_time":"2015-11-05 20:59:04","reward":"11:5_12:5_13:5,4:1_5:1_6:1","status":1,"user_id":19313}

com.alibaba.fastjson.JSONException: unclosed string :
at com.alibaba.fastjson.parser.JSONLexerBase.scanString(JSONLexerBase.java:875)
at com.alibaba.fastjson.parser.DefaultJSONParser.parseObject(DefaultJSONParser.java:387)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1189)
at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1158)
at com.alibaba.fastjson.JSON.parse(JSON.java:102)
at com.alibaba.fastjson.JSON.parse(JSON.java:93)
at com.alibaba.fastjson.JSON.parseObject(JSON.java:164)

@zhaiyuyong

This comment has been minimized.

zhaiyuyong commented Nov 12, 2015

package test;

import com.alibaba.fastjson.JSONObject;

public class FastJsonTest {

public static void main(String[] args) {
    String a = "{\"amount\":1,\"channel_id\":\"wnys01\",\"gem\":1,\"id\":\"pay\",\"login_name\":\"U10722466A\",\"money\":1000,\"order_id\":\"99142AO10000086695A\",\"pay_channel\":\"weilan\",\"pay_time\":\"2015-11-05 20:59:04\",\"reward\":\"11:5_12:5_13:5,4:1_5:1_6:1\",\"status\":1,\"user_id\":19313}";
    A sd = JSONObject.parseObject(a, A.class);
    System.out.println(sd);
}

public static class A{
    private String amount;
    private String channel_id;
    private String gem;
    private String id;
    private String login_name;
    private String money;
    private String order_id;
    private String pay_channel;
    private String pay_time;
    private String reward;
    private String status;
    private String user_id;
    public String getAmount() {
        return amount;
    }
    public void setAmount(String amount) {
        this.amount = amount;
    }
    public String getChannel_id() {
        return channel_id;
    }
    public void setChannel_id(String channel_id) {
        this.channel_id = channel_id;
    }
    public String getGem() {
        return gem;
    }
    public void setGem(String gem) {
        this.gem = gem;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getLogin_name() {
        return login_name;
    }
    public void setLogin_name(String login_name) {
        this.login_name = login_name;
    }
    public String getMoney() {
        return money;
    }
    public void setMoney(String money) {
        this.money = money;
    }
    public String getOrder_id() {
        return order_id;
    }
    public void setOrder_id(String order_id) {
        this.order_id = order_id;
    }
    public String getPay_channel() {
        return pay_channel;
    }
    public void setPay_channel(String pay_channel) {
        this.pay_channel = pay_channel;
    }
    public String getPay_time() {
        return pay_time;
    }
    public void setPay_time(String pay_time) {
        this.pay_time = pay_time;
    }
    public String getReward() {
        return reward;
    }
    public void setReward(String reward) {
        this.reward = reward;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getUser_id() {
        return user_id;
    }
    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }
    @Override
    public String toString() {
        return "A [amount=" + amount + ", channel_id=" + channel_id
                + ", gem=" + gem + ", id=" + id + ", login_name="
                + login_name + ", money=" + money + ", order_id="
                + order_id + ", pay_channel=" + pay_channel + ", pay_time="
                + pay_time + ", reward=" + reward + ", status=" + status
                + ", user_id=" + user_id + "]";
    }

}

}

我使用fastjson版本1.1.39 没问题的

@zhaiyuyong

This comment has been minimized.

zhaiyuyong commented Nov 12, 2015

com.alibaba fastjson 1.1.39

wenshao added a commit that referenced this issue Apr 13, 2016

@wenshao

This comment has been minimized.

Member

wenshao commented Apr 13, 2016

测试新版无法重现问题,先关闭啦

@wenshao wenshao closed this Apr 13, 2016

wenshao added a commit that referenced this issue Apr 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment