Skip to content

Handling JSON Module Compatibility in Transcrypt #868

Closed
@fdsgdshn

Description

@fdsgdshn

Hi,

I've recently started working with Transcrypt, and I'd like to transpile my Python modules to JavaScript using this tool. However, I have some concerns that I'd like to address. I would greatly appreciate your assistance.

Firstly, as far as I've observed, it seems that the json module is not supported by Transcrypt. One solution that comes to mind is creating my own json module and adding it to the source modules, but this appears to be quite laborious. My Python code contains a json file, but since the open command is also not supported by Transcrypt, I've assigned the content of this file directly to a data_json variable.

However, I'm unsure about the approach I should take. For example, how can I convert it to a dictionary data type and access its key-value pairs? I've noticed that JSON.parse command is supported by Transcrypt, but it's not a valid command in Python. I want both my Python and JavaScript code to function correctly. What should I do in this regard? Could you provide some guidance?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions