• 请不要在回答技术问题时复制粘贴 AI 生成的内容
Registering
V2EX  ›  程序员

Gson 解析时遇到编程语言关键字怎么解决

  •  
  •   Registering · Jul 22, 2015 · 3709 views
    This topic created in 4126 days ago, the information mentioned may be changed or developed.
    刚调用第三方api,发现返回的json其中一个字段叫private。

    使用java ,gson解析该json

    不可能在定义对象时定义其中的成员变量为
    private String private;


    怎么破呢
    3 replies  •  2015-07-23 09:17:06 +08:00
    Registering
    Registering
    OP
    Jul 22, 2015❤️1
    1
    解决了

    这样

    @SerializedName("private")
    private boolean isPrivate;
    jsuper
    jsuper
    Jul 22, 2015
    2
    @SerializedName, 请多看下官方文档赛
    StevenTong
    StevenTong
    Jul 23, 2015
    3
    能自己解决最好 平时多看文档
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1520 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:36 · PVG 23:36 · LAX 07:36 · JFK 10:36
    ♥ Do have faith in what you're doing.