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

Nested Records do not convert correctly. #31

Open
Muzz opened this issue Jun 29, 2017 · 2 comments
Open

Nested Records do not convert correctly. #31

Muzz opened this issue Jun 29, 2017 · 2 comments

Comments

@Muzz
Copy link

Muzz commented Jun 29, 2017

type alias ConvertedModel =
    { sliderOptions :
        { rgbo : Bool
        , rgbl : Bool
        , hsvo : Bool
        , hsvl : Bool
        }
    }

Converts to

decodeConvertedModel : Json.Decode.Decoder ConvertedModel
decodeConvertedModel =
    Json.Decode.map4 ConvertedModel
        (field "sliderOptions" decode{ decodeRgbo)
        (field "rgbl" Json.Decode.bool)
        (field "hsvo" Json.Decode.bool)
        (field "hsvl" Json.Decode.bool decode decode decode decode decode decode decode decode})
@Muzz Muzz changed the title Records do not convert correctly. Nested Records do not convert correctly. Jun 29, 2017
@eeue56
Copy link
Owner

eeue56 commented Jun 29, 2017

@Muzz, pull the inner record out and put that in to json-to-elm. Generally not a good idea to have an anonymous record in your record

@Muzz
Copy link
Author

Muzz commented Jun 29, 2017

Ok i'll give that a shot, thanks.

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

2 participants