I am getting a json response, Now I want to convert it to a .CSV file for MSExcel using JavaScript and show users to download or Open it in a dialog box. Please help me out how to do it. Thanks in advance
            Asked
            
        
        
            Active
            
        
            Viewed 1,315 times
        
    0
            
            
        - 
                    1For starters, show us your JSON structure. What have you tried so far? – Alex R. Mar 14 '14 at 09:52
- 
                    Why is this tagged `java`? – fge Mar 14 '14 at 09:53
- 
                    Use Google search a bit more, and then when you have some code come back here. – skywalker Mar 14 '14 at 09:54
- 
                    I am getting a Json response like {"info":{"totalResultCount":628,"resultIndex":1,"resultCount":20},"resultArray":[{"refId":789,"refType":"Location","refValue":"Ornskoldsvik","enabled":"Y"},{"refId":790,"refType":"Location","refValue":"Drayton","enabled":"Y"},{"refId":791,"refType":"Location","refValue":"Namakwa Sands","enabled":"Y"}]} – Tushar Mar 20 '14 at 07:02
- 
                    So I have to convert this into CSV and show to the user that he wants to open it download it or cancel it. I am not getting anything how to do it and make compatible to all browsers. – Tushar Mar 20 '14 at 07:04
1 Answers
0
            
            
        Converting from JSON to CSV must be done by hand using JavaScript as the mapping depends on the JSON content.
Once you have built a CSV string you can do something like this:
 
    
    
        Community
        
- 1
- 1
 
    
    
        Christophe Roussy
        
- 16,299
- 4
- 85
- 85
- 
                    But does this work for IE9 and above, I am not finding any solution for how to show Download, Open or cancel for it. – Tushar Mar 20 '14 at 07:42
 
    