【发布时间】:2023-03-28 06:39:01
【问题描述】:
我目前正在尝试将具有 4 个不同字段的 csv 转换为 json 正文以进行 api 调用。当前的 csv 看起来像这样:
firstname, lastname, email, login
Jake, Smith, jake.smith@example.com, jake.smith@example.com
John, Appleseed, john.appleseed@example.com, john.appleseed@example.com
我希望 json 看起来像这样
{"profile": {"firstName": "Jake", "lastName": "Smith", "email": "jake.smith@example.com", "login": "jake.smith@example.com"}}
{"profile": {"firstName": "John", "lastName": "Appleseed", "email": "john.appleseed@example.com", "login": "john.appleseed@example.com"}}
【问题讨论】:
-
这里是一个教程链接:medium.com/@hannah15198/…
-
您想要 2 个不同的 JSON?不是配置文件数组?
-
@NYCCoder 是的,我想要两个单独的 json,而不是一组配置文件。
标签: python json python-3.x pandas csv