{"html_url": "https://github.com/simonw/sqlite-utils/issues/495#issuecomment-1291159549", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/495", "id": 1291159549, "node_id": "IC_kwDOCGYnMM5M9Yf9", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T21:23:01Z", "updated_at": "2022-10-25T21:23:01Z", "author_association": "OWNER", "body": "I've decided not to explicitly document this, since it's consistent with how other parts of the library work already.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1392690202, "label": "Support JSON values returned from .convert() functions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/495#issuecomment-1291152433", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/495", "id": 1291152433, "node_id": "IC_kwDOCGYnMM5M9Wwx", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T21:14:54Z", "updated_at": "2022-10-25T21:14:54Z", "author_association": "OWNER", "body": "There is a case where the function can return a dictionary at the moment: `multi=True`\r\n\r\n```python\r\ntable.convert(\r\n \"title\", lambda v: {\"upper\": v.upper(), \"lower\": v.lower()}, multi=True\r\n)\r\n```\r\nBut I think this change is still compatible with that. if you don't use `multi=True` then the return value will be stringified. If you DO use `multi=True` then something like this could work:\r\n```python\r\ntable.convert(\r\n \"title\", lambda v: {\"upper\": {\"str\": v.upper()}, \"lower\": {\"str\": v.lower()}}, multi=True\r\n)\r\n```\r\nThis would result in a `upper` and `lower` column, each containing the JSON string `{\"str\": \"UPPERCASE\"}`.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1392690202, "label": "Support JSON values returned from .convert() functions"}, "performed_via_github_app": null} {"html_url": "https://github.com/simonw/sqlite-utils/issues/495#issuecomment-1291149509", "issue_url": "https://api.github.com/repos/simonw/sqlite-utils/issues/495", "id": 1291149509, "node_id": "IC_kwDOCGYnMM5M9WDF", "user": {"value": 9599, "label": "simonw"}, "created_at": "2022-10-25T21:12:11Z", "updated_at": "2022-10-25T21:12:11Z", "author_association": "OWNER", "body": "This makes sense to me. There are other places in the codebase where JSON is automatically stringified: https://github.com/simonw/sqlite-utils/blob/c7e4308e6f49d929704163531632e558f9646e4a/sqlite_utils/db.py#L2759-L2766\r\n\r\nI don't see why the return value from a convert function shouldn't do the same thing.\r\n\r\nSince this will result in previous errors working, I don't think it warrants a major version bump either.", "reactions": "{\"total_count\": 0, \"+1\": 0, \"-1\": 0, \"laugh\": 0, \"hooray\": 0, \"confused\": 0, \"heart\": 0, \"rocket\": 0, \"eyes\": 0}", "issue": {"value": 1392690202, "label": "Support JSON values returned from .convert() functions"}, "performed_via_github_app": null}