The object to decode may contain supplumentary fields, but
if a value is missing, the decoder will fail
>>> Json.Decode.decodeString
... (jsonPseudoList Json.Decode.string)
... """{
... "length": 2,
... "0": "hello"
... }"""
Err "Expecting an object with a field named `1` but instead got: {\"0\":\"hello\",\"length\":2}"
Fails on negative lengths
Of course, if the length is less then 0, decoding fails
>>> Json.Decode.decodeString
... (jsonPseudoList Json.Decode.string)
... """{
... "length": -1
... }"""
Err "I ran into a `fail` decoder: Expecting a positive value for the `length` field"
Create a decoder for objects of the form:
{"length": Number, "0": Value, "1": Value, ...}Decode an Array-like object with two values
Try to decode an invalid Array-like object
The object to decode may contain supplumentary fields, but if a value is missing, the decoder will fail
Fails on negative lengths
Of course, if the length is less then 0, decoding fails