eeue56/json-to-elm

Nested Records do not convert correctly.

Muzz opened this issue · 2 comments

Muzz commented
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, 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 commented

Ok i'll give that a shot, thanks.