Skip to content

fix: handle list format in create_sql.py json_to_sql#39

Merged
yetanotherchris merged 1 commit intomainfrom
claude/issue-34-20260311-0052
Mar 11, 2026
Merged

fix: handle list format in create_sql.py json_to_sql#39
yetanotherchris merged 1 commit intomainfrom
claude/issue-34-20260311-0052

Conversation

@yetanotherchris
Copy link
Copy Markdown
Owner

When convert_chatgpt.py generates JSON files, each file is an array containing a single conversation object with 'user_id' and 'chat' fields, rather than a top-level object with 'userId'. This caused an AttributeError when json_to_sql tried to call .get() on a list.

The fix detects the list format, extracts user_id from the outer object and uses the nested 'chat' object as the chat content for the SQL insert.

Fixes #34

Generated with Claude Code

When convert_chatgpt.py generates JSON files, each file is an array
containing a single conversation object with 'user_id' and 'chat' fields,
rather than a top-level object with 'userId'. This caused an AttributeError
when json_to_sql tried to call .get() on a list.

The fix detects the list format, extracts user_id from the outer object
and uses the nested 'chat' object as the chat content for the SQL insert.

Fixes #34

Co-authored-by: Chris S. <yetanotherchris@users.noreply.github.com>
@yetanotherchris yetanotherchris merged commit fbd9b73 into main Mar 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

create_sql.py: 'list' object has no attribute 'get'

1 participant