expr-lang / expr

Expression language and expression evaluation for Go
https://expr-lang.org
MIT License
5.85k stars 378 forks source link

fromPairs does not work #644

Closed mambla closed 2 months ago

mambla commented 2 months ago

When trying the example from the site in the playground: fromPairs([["name", "John"], ["age", 30]])

We receive the error json: unsupported type: map[interface {}]interface {}

antonmedv commented 2 months ago

fromPairs() works!

This is a restriction of the playground. As it tries to marshal output to JSON to display it and fails.

In Go, json package can marshal map[string]any to string. But fromPairs() returns map[any]any, and we get next message:

json: unsupported type: map[interface {}]interface {}