JsonRemedy.Combinators (json_remedy v0.1.0)
View SourceParser combinator-based JSON repair using NimbleParsec.
This approach builds JSON parsing from small, composable functions that can each handle and repair specific syntax issues. While more elegant than direct parsing, it's currently a placeholder for future implementation.
Summary
Functions
Repairs JSON using parser combinator approach.
Types
Functions
@spec repair( binary(), keyword() ) :: repair_result()
Repairs JSON using parser combinator approach.
Currently delegates to BinaryParser but will be implemented as a proper combinator-based parser in Phase 2.
Parameters
json_string
: The malformed JSON string to repairopts
: Keyword list of options
Returns
{:ok, term()}
if repair succeeds without logging{:ok, term(), [String.t()]}
if repair succeeds with logging enabled{:error, String.t()}
if repair fails
Examples
iex> JsonRemedy.Combinators.repair(~s|{name: "Alice"}|, [])
{:ok, %{"name" => "Alice"}}