Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

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

Closed
enisoc opened this issue Feb 15, 2019 · 2 comments
Closed

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

enisoc opened this issue Feb 15, 2019 · 2 comments

Comments

@enisoc
Copy link

enisoc commented Feb 15, 2019

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.

@mpvl
Copy link
Contributor

mpvl commented Feb 19, 2019

fixed

@cueckoo
Copy link

cueckoo commented Jul 3, 2021

This issue has been migrated to cue-lang/cue#21.

For more details about CUE's migration to a new home, please see cue-lang/cue#1078.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants