Skip to content

starlark-go supports json.encode/decode, but python-starlark-go does not. #192

Description

@torbsorb

Starlark code:

as_json = json.encode('{"key1": 1, "key2": 2}')
print(as_json)

When you run this with starlark_go it works as expected. It prints:

{"key1": 1, "key2": 2}

However, if you do the same with python-starlark-go, then you get

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
starlark_go.errors.ResolveError: <expr>:1:11: undefined: json

Minimal reproducer in Python:

from starlark_go import Starlark

s = Starlark()
s.exec('''as_json = json.encode('{"key1": 1, "key2": 2}')''')
s.eval("as_json")

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions