logo
  • 教程列表
  • SO官方文檔
  • Android 中的 JSON 與 org.json
    • 建立一個簡單的 JSON 物件
    • 建立具有空值的 JSON 字串
    • 將 JSONArray 新增到 JSONObject
    • 解析簡單的 JSON 物件
    • 建立巢狀的 JSON 物件
    • 檢查 JSON 上是否存在欄位
    • 解析 json 時使用空字串
    • 使用 JsonReader 從流中讀取 JSON
    • 處理 JSON 響應的動態金鑰
    • 更新 JSON 中的元素
  1. StackOverflow 文件
  2. Android 教程
  3. Android 中的 JSON 與 org.json
  4. 建立具有空值的 JSON 字串

建立具有空值的 JSON 字串

Created: November-22, 2018

如果你需要生成一個值為 null 的 JSON 字串,如下所示:

{  
   "name":null
}

然後你必須使用特殊常量 JSONObject.NULL 。

功能示例:

jsonObject.put("name", JSONObject.NULL);
  • 將 JSONArray 新增到 JSONObject
  • 建立一個簡單的 JSON 物件

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明