hydra.json.parser module

JSON parser using Hydra parser combinators.

hydra.json.parser.digit() → Parser[int]

Parse a single digit (0-9).

hydra.json.parser.digits() → Parser[str]

Parse one or more digits as a string.

hydra.json.parser.json_array() → Parser[Value]

Parse a JSON array.

hydra.json.parser.json_bool() → Parser[Value]

Parse JSON boolean (true or false).

hydra.json.parser.json_escape_char() → Parser[int]

Parse a JSON escape sequence after the backslash.

hydra.json.parser.json_exponent_part() → Parser[object]

Parse the optional exponent part of a JSON number.

hydra.json.parser.json_fraction_part() → Parser[object]

Parse the optional fractional part of a JSON number.

hydra.json.parser.json_integer_part() → Parser[str]

Parse the integer part of a JSON number (optional minus, then digits).

hydra.json.parser.json_key_value() → Parser[tuple[str, Value]]

Parse a JSON object key-value pair.

hydra.json.parser.json_null() → Parser[Value]

Parse JSON null value.

hydra.json.parser.json_number() → Parser[Value]

Parse a JSON number (integer, decimal, or scientific notation).

hydra.json.parser.json_object() → Parser[Value]

Parse a JSON object.

hydra.json.parser.json_string() → Parser[Value]

Parse a JSON string value.

hydra.json.parser.json_string_char() → Parser[int]

Parse a single character in a JSON string (handling escapes).

hydra.json.parser.json_value() → Parser[Value]

Parse any JSON value.

hydra.json.parser.parse_json(input: str) → object

Parse a JSON document from a string.

hydra.json.parser.token(p: Parser[T0]) → Parser[T0]

Parse a token followed by optional whitespace.

hydra.json.parser.whitespace() → Parser[None]

Parse zero or more JSON whitespace characters (space, tab, newline, carriage return).