{"id":20806918,"url":"https://github.com/agentgill/csv-export","last_synced_at":"2026-05-28T08:31:19.193Z","repository":{"id":152506986,"uuid":"223222687","full_name":"agentgill/csv-export","owner":"agentgill","description":"Parsing Salesforce JSON as a CSV file","archived":false,"fork":false,"pushed_at":"2019-11-21T17:58:37.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-19T15:34:56.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agentgill.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-21T16:58:45.000Z","updated_at":"2019-11-21T20:15:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6bfc634-d42d-4cef-a068-3b02e2eef454","html_url":"https://github.com/agentgill/csv-export","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agentgill/csv-export","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentgill%2Fcsv-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentgill%2Fcsv-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentgill%2Fcsv-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentgill%2Fcsv-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agentgill","download_url":"https://codeload.github.com/agentgill/csv-export/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agentgill%2Fcsv-export/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33601380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T19:28:40.666Z","updated_at":"2026-05-28T08:31:19.176Z","avatar_url":"https://github.com/agentgill.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parsing Salesforce json response is easy\n\nSometimes the best way to hanlde salesforce data is in json. If you like exeucting soql queries\nwhich include related fields, while you can see the results in developer console, if you were to execute\nthe soql query via the sfdx cli like this -\n\n```bash\nsfdx force:data:soql:query -q \"SELECT Id, Subject, WhatId, Owner.Name,Type,\n    TYPEOF What WHEN Case THEN Contact.Email, Contact.State__c END\nFROM Task\nWHERE\n      What.Type IN ('Case')  AND Subject like '%legal%' and Type = 'Call'\nAND\n       WhatId   IN (SELECT Id FROM Case WHERE RecordType.Name != 'iContact Service'\nAND ClosedDate != TODAY)\n\" -r csv \u003e data/input.csv\n\n```\n\nYou would see this -\n\n```csv\nId,Subject,WhatId,Owner.Name,Type,What\n00T3E00000BpvEtUAJ,Legal Case,5003E00000FjvYQQAZ,Micheal Gill,Call,[object Object]\n00T3E00000BqL8VUAV,Legal,5003E00000FjvYQQAZ,Micheal Gill,Call,[object Object]\n```\n\nHowever output as json -\n\n```bash\nsfdx force:data:soql:query -q \"SELECT Id, Subject, WhatId, Owner.Name,Type,\n    TYPEOF What WHEN Case THEN Contact.Email, Contact.State__c END\nFROM Task\nWHERE\n      What.Type IN ('Case')  AND Subject like '%legal%' and Type = 'Call'\nAND\n       WhatId   IN (SELECT Id FROM Case WHERE RecordType.Name != 'iContact Service'\nAND ClosedDate != TODAY)\n\" -r json \u003e data/input.json\n\n```\n\nAnd you now get all your data...\n\n```json\n{\n  \"status\": 0,\n  \"result\": {\n    \"totalSize\": 2,\n    \"done\": true,\n    \"records\": [\n      {\n        \"attributes\": {\n          \"type\": \"Task\",\n          \"url\": \"/services/data/v46.0/sobjects/Task/00T3E00000BpvEtUAJ\"\n        },\n        \"Id\": \"00T3E00000BpvEtUAJ\",\n        \"Subject\": \"Legal Case\",\n        \"WhatId\": \"5003E00000FjvYQQAZ\",\n        \"Owner\": {\n          \"attributes\": {\n            \"type\": \"Name\",\n            \"url\": \"/services/data/v46.0/sobjects/User/0053E000003dbA5QAI\"\n          },\n          \"Name\": \"Micheal Gill\"\n        },\n        \"Type\": \"Call\",\n        \"CaseOwnerTeam__c\": \"Legal Services\",\n        \"What\": {\n          \"attributes\": {\n            \"type\": \"Case\",\n            \"url\": \"/services/data/v46.0/sobjects/Case/5003E00000FjvYQQAZ\"\n          },\n          \"Contact\": {\n            \"attributes\": {\n              \"type\": \"Contact\",\n              \"url\": \"/services/data/v46.0/sobjects/Contact/0033E00001ASR8YQAX\"\n            },\n            \"Email\": \"acegill2013@gmail.com\",\n            \"State__c\": \"Prospect\"\n          }\n        }\n      },\n      {\n        \"attributes\": {\n          \"type\": \"Task\",\n          \"url\": \"/services/data/v46.0/sobjects/Task/00T3E00000BqL8VUAV\"\n        },\n        \"Id\": \"00T3E00000BqL8VUAV\",\n        \"Subject\": \"Legal\",\n        \"WhatId\": \"5003E00000FjvYQQAZ\",\n        \"Owner\": {\n          \"attributes\": {\n            \"type\": \"Name\",\n            \"url\": \"/services/data/v46.0/sobjects/User/0053E000003dbA5QAI\"\n          },\n          \"Name\": \"Micheal Gill\"\n        },\n        \"Type\": \"Call\",\n        \"CaseOwnerTeam__c\": \"Legal Services\",\n        \"What\": {\n          \"attributes\": {\n            \"type\": \"Case\",\n            \"url\": \"/services/data/v46.0/sobjects/Case/5003E00000FjvYQQAZ\"\n          },\n          \"Contact\": {\n            \"attributes\": {\n              \"type\": \"Contact\",\n              \"url\": \"/services/data/v46.0/sobjects/Contact/0033E00001ASR8YQAX\"\n            },\n            \"Email\": \"acegill2013@gmail.com\",\n            \"State__c\": \"Prospect\"\n          }\n        }\n      }\n    ]\n  }\n}\n```\n\njson looks great but sometime all you really want is a CSV file!\n\nWith a little help of node and the following libraries - you can injest json and output as csv\n\n- json2csv\n- fs\n\n```bash\nnode bin/export.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentgill%2Fcsv-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagentgill%2Fcsv-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagentgill%2Fcsv-export/lists"}