【问题标题】:Codename One converting String to JSON object代号一将字符串转换为 JSON 对象
【发布时间】:2016-11-05 06:41:18
【问题描述】:

如何将此字符串转换为代号中的 JSON 数据。

{result_code=0.0, data=[{id=1007747505, name=Test, dob=1986-05-16, identification=6837904, otherinformation=, status=Active, classid=11, class=Twenty, start_date=2016-05-27, end_date=2017-05-26}], message=OK}

【问题讨论】:

    标签: json codenameone


    【解决方案1】:

    您可以按照developer guide 中的描述使用JSONParser 类:

    JSONParser p = new JSONParser();
    Map<String, Object> results = p.parseJSON(new CharArrayReader("{result_code=0.0, data=[{id=1007747505, name=Test, dob=1986-05-16, identification=6837904, otherinformation=, status=Active, classid=11, class=Twenty, start_date=2016-05-27, end_date=2017-05-26}], message=OK}".toCharArray());
    

    诀窍是在该行之后放置一个断点并查看“结果”的内容以查看解析器返回的数据结构。

    【讨论】:

      猜你喜欢
      • 2019-08-27
      • 2020-05-27
      • 1970-01-01
      • 1970-01-01
      • 2011-04-23
      • 2012-06-14
      • 2012-02-20
      • 2015-01-03
      相关资源
      最近更新 更多