Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/encoding/json: Unmarshal() gives mangled result #21

Closed
cueckoo opened this issue Jul 3, 2021 · 1 comment
Closed

pkg/encoding/json: Unmarshal() gives mangled result #21

cueckoo opened this issue Jul 3, 2021 · 1 comment

Comments

@cueckoo
Copy link
Collaborator

cueckoo commented Jul 3, 2021

Originally opened by @enisoc in cuelang/cue#21

As of current master, the following CUE program doesn't evaluate as expected:

import "encoding/json"

input: "{\"one\": 1, \"two\": 2, \"three\": 3}"
result: json.Unmarshal(input)

Expected output:

{
    "input": "{\"one\": 1, \"two\": 2, \"three\": 3}",
    "result": {
        "one": 1,
        "two": 2,
        "three": 3
    }
}

Actual output (cue export):

{
    "input": "{\"one\": 1, \"two\": 2, \"three\": 3}",
    "result": {
        "Valid": 1,
        "Compact": 2,
        "Indent": 3
    }
}

Notice the field names in the unmarshaled result have been replaced with the names of methods in pkg/encoding/json.

@cueckoo cueckoo closed this as completed Jul 3, 2021
@cueckoo
Copy link
Collaborator Author

cueckoo commented Jul 3, 2021

Original reply by @mpvl in cuelang/cue#21 (comment)

fixed

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

No branches or pull requests

1 participant