vjrasane / elm-dynamic-json / Json.Dynamic

Process dynamic JSON structures with simple utility functions

Convenience


type alias Dynamic a =
Result Json.Decode.Error a

Convenience alias for a dynamic JSON value

dynamic : a -> Dynamic a

Lift value to a dynamic value

decoder : Json.Decode.Decoder Json.Decode.Value

Decoder alias. You can use Decode.value directly instead.

equals : a -> Dynamic a -> Basics.Bool

Convenience function for comparing a dynamic value to a value

Nested structures

at : List String -> Dynamic Json.Decode.Value -> Dynamic Json.Decode.Value

Access a nested JSON value by field name path

index : Basics.Int -> Dynamic Json.Decode.Value -> Dynamic Json.Decode.Value

Access a nested JSON value by array index

filter : (Dynamic Json.Decode.Value -> Basics.Bool) -> Dynamic Json.Decode.Value -> List (Dynamic Json.Decode.Value)

Filters the list of JSON values by the given predicate

find : (Dynamic Json.Decode.Value -> Basics.Bool) -> Dynamic Json.Decode.Value -> Maybe (Dynamic Json.Decode.Value)

Finds a matching value from list of JSON values by the given predicate

Resolving values

resolve : Json.Decode.Decoder a -> Dynamic Json.Decode.Value -> Dynamic a

Resolve the dynamic JSON value to a Result Decode.Error a, using the given Decoder a to decode it.

resolveAt : List String -> Json.Decode.Decoder a -> Dynamic Json.Decode.Value -> Dynamic a

Resolve nested dynamic JSON value by field name path to a Result Decode.Error a, using the given Decoder a to decode it.