Bourse.JsonDocument (bourse v0.1.0)

Copy Markdown View Source

Strict JSON document decoding shared by compile-time loaders.

Rejects duplicate object keys at any nesting level before decoding with Jason, so hand-edited documents fail loudly instead of silently keeping the first key occurrence.

Summary

Functions

Decodes a JSON document after rejecting duplicate object keys.

Functions

decode_file!(path)

@spec decode_file!(String.t()) :: map()

Decodes a JSON document after rejecting duplicate object keys.

Raises ArgumentError naming the file, duplicated key, and object path on duplicates. Malformed JSON still raises Jason.DecodeError with a byte position rather than an opaque :json ErlangError.