在android中生成这个复杂的json

时间:2014-05-11 14:25:38

标签: java android json

在我的应用程序中,我需要从我的sqlite数据库中获取所有条目并生成此json以在drupal站点中创建节点,我是Json中的新用户请告诉我实现此目的的最佳方法:

{ "body" : [  ],
    "changed" : "1393522835",
    "cid" : "0",
    "comment" : "1",
    "comment_count" : "0",
    "created" : "1393522835",
    "data" : "a:1:{s:7:\"contact\";i:0;}",
    "field_associatedterm" : { "und" : [ { "target_id" : "2" } ] },
    "field_fat" : { "und" : [ { "value" : "24.4" } ] },
    "field_creationts" : { "und" : [ { "value" : "1391016769" } ] },
    "field_key" : { "und" : [ { "format" : null,
              "safe_value" : "12312312-1123123",
              "value" : "12312312-1123123"
            } ] },
    "field_devicename" : { "und" : [ { "format" : null,
              "safe_value" : "iPhone",
              "value" : "iPhone"
            } ] },
    "field_devices" : [  ],
    "field_editts" : [  ],
    "field_entrydate" : { "und" : [ { "date_type" : "datetime",
              "timezone" : "Europe/London",
              "timezone_db" : "Europe/London",
              "value" : "2013-06-05 09:45:00"
            } ] },
    "field_humor" : { "und" : [ { "value" : "1" } ] },
    "field_synchts" : [  ],
    "field_text" : { "und" : [ { "format" : null,
              "safe_value" : """",
              "value" : "\"\""
            } ] },
    "field_timezonename" : [  ],
    "field_timezoneoffset" : [  ],
    "field_useruniqueid" : [  ],
    "field_number" : { "und" : [ { "value" : "12" } ] },
    "language" : "pt-pt",
    "last_comment_name" : null,
    "last_comment_timestamp" : "1393522835",
    "last_comment_uid" : "1",
    "log" : "",
    "metatags" : [  ],
    "name" : "admin",
    "nid" : "302",
    "picture" : "0",
    "promote" : "1",
    "revision_timestamp" : "1393522835",
    "revision_uid" : "1",
    "status" : "1",
    "sticky" : "0",
    "title" : "2013-06-05 08:39:01 +0000",
    "tnid" : "0",
    "translate" : "0",
    "type" : "entry",
    "uid" : "1",
    "vid" : "302"
  },

1 个答案:

答案 0 :(得分:0)

如果你使用一些工具从json字符串生成代码,这并不难。就像这个:http://jsongen.byingtondesign.com/。 我确信有更多有用的工具可以完成这项工作。