mardi 27 janvier 2015

convert json to csv format

I try to use as input a file in json format. Here is a snippet of example data.



[
{
id: 1671349531,
name: "A Wild Restaurant Expansion",
blurb: "We are looking to expand from our current location to a new and better facility. One that will be available for our our followers!",
goal: 17000,
pledged: 0,
state: "live",
slug: "a-wild-restaurant-expansion",
disable_communication: false,
country: "US",
currency: "USD",
currency_symbol: "$",
currency_trailing_code: true,
deadline: 1425185940,
state_changed_at: 1422373209,
created_at: 1422141288,
launched_at: 1422373209,
backers_count: 0,
photo: {
full: "http://ift.tt/1JYNZ1W",
ed: "http://ift.tt/1CdMEVT",
med: "http://ift.tt/1JYNXqZ",
little: "http://ift.tt/1CdMFcd",
small: "http://ift.tt/1JYNXHh",
thumb: "http://ift.tt/1CdMFch",
1024x768: "http://ift.tt/1JYNZin",
1536x1152: "http://ift.tt/1CdMH3O"
},
creator: {
id: 602131664,
name: "Chef James Nelson",
avatar: {
thumb: "http://ift.tt/1CdMH3Q",
small: "http://ift.tt/1CdMH3T",
medium: "http://ift.tt/1JYNZix"
},
urls: {
web: {
user: "http://ift.tt/1CdMFsJ"
},
api: {
user: "http://ift.tt/1JYNXHt"
}
}
},
location: {
id: 2433186,
name: "Kissimmee",
slug: "kissimmee-fl",
short_name: "Kissimmee, FL",
displayable_name: "Kissimmee, FL",
country: "US",
state: "FL",
type: "Town",
is_root: false,
urls: {
web: {
discover: "http://ift.tt/1JYNZyR",
location: "http://ift.tt/1JYNZyT"
},
api: {
nearby_projects: "http://ift.tt/1CdMFsX"
}
}
},
category: {
id: 312,
name: "Restaurants",
slug: "food/restaurants",
position: 9,
parent_id: 10,
urls: {
web: {
discover: "http://ift.tt/1CdMFt1"
}
}
},
urls: {
web: {
project: "http://ift.tt/1JYNZyZ",
rewards: "http://ift.tt/1JYNZz7"
}
}
},
{
id: 267033207,
name: "The Razors Edge ~ (based on the book Giggling in Fairmont).",
blurb: "An indie film to follow up on the recently published book. In it's first few weeks of release it has taken a strong grip on the world.",
goal: 5000,
pledged: 0,
state: "live",
slug: "the-razors-edge-based-on-the-book-giggling-in-fair",
disable_communication: false,
country: "US",
currency: "USD",
currency_symbol: "$",
currency_trailing_code: true,
deadline: 1424964564,
state_changed_at: 1422372564,
created_at: 1421465861,
launched_at: 1422372564,
backers_count: 0,
photo: {
full: "http://ift.tt/1CdMFJl",
ed: "http://ift.tt/1JYNZPp",
med: "http://ift.tt/1CdMFJn",
little: "http://ift.tt/1JYO0Dc",
small: "http://ift.tt/1CdMHkp",
thumb: "http://ift.tt/1CdMFZL",
1024x768: "http://ift.tt/1JYNZPw",
1536x1152: "http://ift.tt/1CdMFZN"
},
creator: {
id: 198971258,
name: "Jesse Gerken",
avatar: {
thumb: "http://ift.tt/1CdMHkv",
small: "http://ift.tt/1CdMHkz",
medium: "http://ift.tt/1JYO0Ty"
},
urls: {
web: {
user: "http://ift.tt/1CdMFZV"
},
api: {
user: "http://ift.tt/1JYO05X"
}
}
},
location: {
id: 2401584,
name: "Fairmont",
slug: "fairmont-wv",
short_name: "Fairmont, WV",
displayable_name: "Fairmont, WV",
country: "US",
state: "WV",
type: "Town",
is_root: false,
urls: {
web: {
discover: "http://ift.tt/1JYO0TA",
location: "http://ift.tt/1JYO0TE"
},
api: {
nearby_projects: "http://ift.tt/1CdMHAR"
}
}
},
category: {
id: 297,
name: "Horror",
slug: "film & video/horror",
position: 10,
parent_id: 11,
urls: {
web: {
discover: "http://ift.tt/1JYO0TI"
}
}
},
urls: {
web: {
project: "http://ift.tt/1CdMHB2",
rewards: "http://ift.tt/1JYO061"
}
}
},
{
id: 1791731386,
name: "PulseAuction",
blurb: "Seeking promotional funding for PulseAuction.com - a PATENTED online auction site. We've banished Per-Bid Fees! Join The Revolution.",
goal: 7000,
pledged: 0,
state: "live",
slug: "pulseauction",
disable_communication: false,
country: "US",
currency: "USD",
currency_symbol: "$",
currency_trailing_code: true,
deadline: 1424964553,
state_changed_at: 1422372553,
created_at: 1419635170,
launched_at: 1422372553,
backers_count: 0,
photo: {
full: "http://ift.tt/1CdMGgw",
ed: "http://ift.tt/1CdMGwM",
med: "http://ift.tt/1CdMGwQ",
little: "http://ift.tt/1JYO069",
small: "http://ift.tt/1CdMHRu",
thumb: "http://ift.tt/1CdMGx0",
1024x768: "http://ift.tt/1JYO1a4",
1536x1152: "http://ift.tt/1CdMHRC"
},
creator: {
id: 835111372,
name: "WW Pulse Inc. dba PulseAuction.com",
avatar: {
thumb: "http://ift.tt/1JYO1aa",
small: "http://ift.tt/1CdMJsu",
medium: "http://ift.tt/1CdMJsy"
},
urls: {
web: {
user: "http://ift.tt/1CdMJsA"
},
api: {
user: "http://ift.tt/1CdMI7U"
}
}
},
location: {
id: 23689683,
name: "South Florida",
slug: "south-florida-fl",
short_name: "South Florida, FL",
displayable_name: "South Florida, FL",
country: "US",
state: "FL",
type: "Town",
is_root: false,
urls: {
web: {
discover: "http://ift.tt/1JYO1qG",
location: "http://ift.tt/1JYO3ib"
},
api: {
nearby_projects: "http://ift.tt/1JYO3if"
}
}
},
category: {
id: 342,
name: "Web",
slug: "technology/web",
position: 15,
parent_id: 16,
urls: {
web: {
discover: "http://ift.tt/1CdMJIY"
}
}
},
urls: {
web: {
project: "http://ift.tt/1JYO3yD",
rewards: "http://ift.tt/1JYO3yH"
}
}
}


Could be possible in r to make a csv using this complex json format in order to handle the data smoother?


For example there are these basic catagories: basic information photo creator location category urls


Could be possible to make a csv file with gategories of subcategories like basic_information.id, creator.id etc?


Aucun commentaire:

Enregistrer un commentaire