将New对象添加到现有的json文件Android Java

时间:2016-01-09 21:22:12

标签: java android json android-studio jsonobject

我的json文件:DB.json

{
"Jobs":[
{
"Name":"Chef",
"StartDate":"1/1/2016",
"EndDate":"5/1/2016",
"Location":"Haifa",
"Description":"Chef in italian restaurant",
"Requirements":"little experience",
"Phone":"050-0000000"
},
{
"Name":"Mailman",
"StartDate":"11/1/2016",
"EndDate":"21/1/2016",
"Location":"Akko",
"Description":"two hours shift as mailman in Haifa area",
"Requirements":"knowledge of the city locations",
"Phone":"050-0000001"
},
{
"Name":"Waiter",
"StartDate":"10/1/2016",
"EndDate":"29/1/2016",
"Location":"Tel Aviv",
"Description":"Double shifts at beach restaurants in haifa",
"Requirements":"couple months of experience",
"Phone":"050-0000002"
},
{
"Name":"Barman",
"StartDate":"15/2/2016",
"EndDate":"22/2/2016",
"Location":"Beer sheva",
"Description":"For morning shifts at good bar in the city center",
"Requirements":"Done it before",
"Phone":"050-0000003"
},
{
"Name":"Dishwasher",
"StartDate":"17/1/2016",
"EndDate":"1/2/2016",
"Location":"Ashdod",
"Description":"Needed for night shifts at most",
"Requirements":"None",
"Phone":"050-0000004"
}
]}

我的对象适配器类:

package com.example.rami.jobseeker;


    public class Jobs {
        private String name;
        private String StartD;
        private String EndD;
        private String Location;
        private String Des;
        private String Req;
        private String phone;

使用setter和getter

我需要在最后添加一个对象作为数组,我现在可以读取一个json文件并将其转换为字符串,然后将数据放入列表中。 但现在我要写进去,不要只读它。

0 个答案:

没有答案