You need to sign in to do that
Don't have an account?
Anil Savaliya
Json Response to Csv conversation
Hi Guys,
I am implementing API with our system,After Rest API call i getting JSON response,Please see in example for json response,i need to convert JSON string in CSV file and need export csv, How can i implement ? Any Idea ? sample code ?
Response :
[
{
"Revenue": "$1,000,000",
"Employees": "12345",
"MarketCap": "$1,000,000",
"Website": "www.yahoo.com",
"WebsiteURL": "http://www.yahoo.com",
"Industry": "Information Technology",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|345222",
"DisplayName": "Yahoo News"
},
{
"Revenue": "$2,000,000",
"Employees": "345435",
"MarketCap": "$1,02300,000",
"Website": "www.google.com",
"WebsiteURL": "http://www.google.com",
"Industry": "Information Technology",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|5323232",
"DisplayName": "Google Search"
},
{
"Revenue": "$5000,000,000",
"Employees": "500000",
"MarketCap": "$2,000,0000000",
"Website": "www.apple.com",
"WebsiteURL": "http://www.apple.com",
"Industry": "Telecommunication",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|534534",
"DisplayName": "Apple News"
}
]
I am implementing API with our system,After Rest API call i getting JSON response,Please see in example for json response,i need to convert JSON string in CSV file and need export csv, How can i implement ? Any Idea ? sample code ?
Response :
[
{
"Revenue": "$1,000,000",
"Employees": "12345",
"MarketCap": "$1,000,000",
"Website": "www.yahoo.com",
"WebsiteURL": "http://www.yahoo.com",
"Industry": "Information Technology",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|345222",
"DisplayName": "Yahoo News"
},
{
"Revenue": "$2,000,000",
"Employees": "345435",
"MarketCap": "$1,02300,000",
"Website": "www.google.com",
"WebsiteURL": "http://www.google.com",
"Industry": "Information Technology",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|5323232",
"DisplayName": "Google Search"
},
{
"Revenue": "$5000,000,000",
"Employees": "500000",
"MarketCap": "$2,000,0000000",
"Website": "www.apple.com",
"WebsiteURL": "http://www.apple.com",
"Industry": "Telecommunication",
"LongDescription": "Long text",
"Description": "Discripting here",
"NodeID": "Org|534534",
"DisplayName": "Apple News"
}
]
pcon
This should get you what you want. It's not really tested so it may not work well for large json sets or json that is missing elements.