Android How to read Gson object in android? -
i have response
{ "status_code": 200, "body": { "cancreate": 0, "totalitemcount": 76, "response": [ { "blog_id": 182, "title": "test blog", "body": "<p>dssadasddaasd<\/p>\r\n<p><img src=\"\/seapidev\/public\/album_photo\/7c\/04\/0478_3c26.png?c=440c\" alt=\"\"><\/p>", "owner_type": "user", "owner_id": 1, "category_id": 1, "creation_date": "2015-04-22 07:16:28", "modified_date": "2015-04-22 07:16:28", "view_count": 3, "comment_count": 0, "search": 1, "draft": 0, "category_title": "arts & culture", "url": "http:\/\/dev1.bigsteptech.in\/seapidev\/blogs\/1\/182\/test-blog", "owner_url": "http:\/\/dev1.bigsteptech.in\/seapidev\/profile\/admin", "owner_image": "http:\/\/dev1.bigsteptech.in\/seapidev\/public\/user\/69\/04\/0465_82ca.png?c=b4e4", "owner_title": "socialengineaddons admin", "allow_to_view": 1 } ] } }
i want convert in gson , read it, how can replicate file structure in project??
can please me new android.
thanks in advance...
create java class java equivalent of json use site like: json2pojo (http://www.jsonschema2pojo.org/) you.
then convert json java object can following:
gson = new gson(); object obj = (object) gson.fromjson(json, object.class);
where object custom object.
Comments
Post a Comment