|u&      !"#$%None <&'((&'(NoneC)*+,-./0123456)*+,-./0123456 )*+,-./0123456None7)Public interface for parsing JSON tokens.8vfound element, continuation, actual parsing view - so that we can report the unparsed data when the parsing finishes.798:;<=>?@ABCD 798:;<=>?@ABC798:;<=>?@ABCDNoneVE*Header for the C routing for batch parsingFLimit for maximum size of a number; fail if larger number is found this is needed to make this constant-space, otherwise we would eat all memory just memoizing the number. The lexer fails if larger number is encountered.G*Hardcoded result record size (see lexer.h)HBParse number from bytestring to Scientific using JSON syntax rulesIParse particular resultJ&Estimate number of elements in a chunk!KLMNOPEQRSTUVWXYZ[\F]G^_`abHIJcde(dKLMNOPEQRSTUVWXYZ[\F]G^_`abHIJcde BSD-stylepalkovsky.ondrej@gmail.com experimentalportableNoneFN4>Result of parsing. Contains continuations to continue parsing.Returns a value from a parser.+Parser needs more data to continue parsing."Parsing failed, error is reported.,Parsing finished, unparsed data is returned.A representation of the parser.fPrivate parsing resultg#Limit for the size of an object keyh.Yield list of results, finish with last actionMatch all items of an array.iGenerate start/end objects when an element is found, in between run a parser. The inner parser is not run if an array is not found.Generate start/end values when an object is found, in between run a parser. The inner parser is not run if an array is not found.Generate start/end values when an array is found, in between run a parser. The inner parser is not run if an array is not found.Alet test = "[[1,2,3],true,[],false,{\"key\":1}]" :: BS.ByteStringIparseByteString (arrayOf (arrayFound 10 20 (1 .! integer))) test :: [Int][10,2,20,10,20] Match nith item in an array. 1Match all items of an array, add index to output.jUGo through an object; if once is True, yield only first success, then ignore the restk:Helper function to deduplicate TokMoreData/FokFailed logic Match all key-value pairs of an object, return them as a tuple. If the source object defines same key multiple times, all values are matched. Match all key-value pairs of an object, return only values. If the source object defines same key multiple times, all values are matched. Keys are ignored. Match only specific key of an object. This function will return only the first matched value in an object even if the source JSON defines the key multiple times (in violation of the specification).l1Parses underlying values and generates a AE.ValuempConvert a strict aeson value (no object/array) to a value. Non-matching type is ignored and not parsed (unlike )n:Match a possibly bounded string roughly limited by a limit+Parse string value, skip parsing otherwise.Stops parsing string after the limit is reached. The string will not be matched if it exceeds the size. The size is the size of escaped string including escape characters.*Parse number, return in scientific format.#Parse to bounded integer type (not oX). If you are using integer numbers, use this parser. It skips the conversion JSON -> p -> q and uses an q directly.Parse to float/double.)Parse bool, skip if the type is not bool.Match a null value.*Parses a field with a possible null value.Match FromJSON, value. Calls parseJSON on the parsed value.1let json = "[{\"key1\": [1,2], \"key2\": [5,6]}]"2parseByteString (arrayOf value) json :: [AE.Value]c[Object (fromList [("key2",Array [Number 5.0,Number 6.0]),("key1",Array [Number 1.0,Number 2.0])])]Take maximum n matching items.LparseByteString (takeI 3 $ arrayOf integer) "[1,2,3,4,5,6,7,8,9,0]" :: [Int][1,2,3]r&Skip rest of string + call next parsers5Skip value; cheat to avoid parsing and make it faster)Let only items matching a condition pass.QparseByteString (filterI (>5) $ arrayOf integer) "[1,2,3,4,5,6,7,8,9,0]" :: [Int] [6,7,8,9]}A back-door for lifting of possibly failing actions. If an action fails with Left value, convert it into failure of parsing Synonym for   . Matches key in an object. The  operators can be chained.,let json = "{\"key1\": {\"nested-key\": 3}}"AparseByteString ("key1" .: "nested-key" .: integer) json :: [Int][3]Returns t@ if value is null or does not exist or match. Otherwise returns u value. #key .:? val = optional (key .: val)MReturn default value if the parsers on the left hand didn't produce a result. p .| defval = p <|> pure defvalMThe operator works on complete left side, the following statements are equal: zRecord <$> "key1" .: "nested-key" .: value .| defaultValue Record <$> (("key1" .: "nested-key" .: value) .| defaultValue) Synonym for  . Matches n-th item in array.RparseByteString (arrayOf (1 .! bool)) "[ [1,true,null], [2,false], [3]]" :: [Bool] [True,False](Run streaming parser with initial input.*Run streaming parser, immediately returns . aParse a bytestring, generate lazy list of parsed values. If an error occurs, throws an exception.6parseByteString (arrayOf integer) "[1,2,3,4]" :: [Int] [1,2,3,4]YparseByteString (arrayOf ("name" .: string)) "[{\"name\":\"KIWI\"}, {\"name\":\"BIRD\"}]"["KIWI","BIRD"]!fParse a lazy bytestring, generate lazy list of parsed values. If an error occurs, throws an exception."#Deserialize a JSON value from lazy v.2If this fails due to incomplete or invalid input, t is returned.^The input must consist solely of a JSON document, with no trailing data except for whitespace.#Like "2 but returns an error message when decoding fails.$Like ", but on strict w%Like #, but on strict wxMatch items from the first parser, if none is matched, return items from the second parser. Constant-space if second parser returns constant number of items. $ is implemented using this operator.Blet json = "[{\"key1\": [1,2], \"key2\": [5,6], \"key3\": [8,9]}]"Nlet parser = arrayOf $ "key1" .: (arrayOf value) <|> "key2" .: (arrayOf value)$parseByteString parser json :: [Int][1,2]Qlet parser = arrayOf $ "key-non" .: (arrayOf value) <|> "key2" .: (arrayOf value)$parseByteString parser json :: [Int][5,6]y* - Gather matches and return them as list.Ulet json = "[{\"keys\":[1,2], \"values\":[5,6]}, {\"keys\":[9,8], \"values\":[7,6]}]"flet parser = arrayOf $ (,) <$> many ("keys" .: arrayOf integer) <*> many ("values" .: arrayOf integer)/parseByteString parser json :: [([Int], [Int])][([1,2],[5,6]),([9,8],[7,6])]z<>G will run both parsers in parallel yielding from both as the data comes:m +Data.MonoidBlet test = "[{\"key1\": [1,2], \"key2\": [5,6], \"key3\": [8,9]}]"Mlet parser = arrayOf $ "key1" .: (arrayOf value) <> "key2" .: (arrayOf value)$parseByteString parser test :: [Int] [1,2,5,6]{|7 will run both parsers in parallel and combine results.RIt behaves as a list functor (produces all combinations), but the typical use is::set -XOverloadedStringsTlet text = "[{\"name\": \"John\", \"age\": 20}, {\"age\": 30, \"name\": \"Frank\"}]"Elet parser = arrayOf $ (,) <$> "name" .: string <*> "age" .: integer-parseByteString parser text :: [(T.Text,Int)][("John",20),("Frank",30)]>}~fghi jk lmnrs !"#$%xz{&  !"#$%& !"#$%  4}~fghi jk lmnrs !"#$%xz{      !"#$%&'()*+,-.//0123456789:;<=>?@ABCDEFGHIJKLMNOPPQRSTJUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~|}|}|} jsons_JNr51nUmxh70rDwsai37JYData.JsonStream.ParserData.JsonStream.UnescapeData.JsonStream.CLexTypeData.JsonStream.TokenParserData.JsonStream.CLexer ParseOutput ParseYield ParseNeedData ParseFailed ParseDoneParserarrayOf objectFound arrayFoundarrayWithIndexOfindexedArrayOf objectItems objectValues objectWithKeystring safeStringnumberintegerrealbooljNullnullablevaluetakeIfilterImapWithFailure.:.:?.|.! runParser' runParserparseByteStringparseLazyByteStringdecode eitherDecode decodeStricteitherDecodeStrict c_js_decode unescapeText' unescapeText LexResultType resNumber resStringresTrueresFalseresNull resOpenBrace resCloseBraceresOpenBracketresCloseBracketresStringPartialresNumberPartialresNumberSmall TokenResult PartialResult TokMoreData TokFailedElement ArrayBeginArrayEnd ObjectBegin ObjectEnd StringContent StringEndJValueJInteger$fShowTokenResultHeadernumberDigitLimit resultRecSize parseNumber parseResultsestResultLimitTempData tmpBuffer tmpHeadertmpError tmpNumbershdrCurrentState hdrStateData hdrStateSata2 hdrPosition hdrLength hdrResultNumhdrResultLimit ResultPtrunresPtrlexJson defHeaderpeekResultFieldpeekResultAddDatapeekResultTypecallLexsubstr getNextResult tokenParser$fStorableHeader ParseResultobjectKeyStringLimit yieldResults elemFoundobject'moreDataaeValuejvalue longString integer-gmpGHC.Integer.TypeIntegerscien_AqBmwDfwK7K24A70hu3AxFData.Scientific Scientificghc-prim GHC.TypesIntignoreStrRestThen ignoreValbaseGHC.BaseNothingJustbytes_6VWy06pWzJq9evDvK2d4w6Data.ByteString.Lazy.Internal ByteStringData.ByteString.Internal$fAlternativeParsermany$fMonoidParser$fApplicativeParser<*> callParseMoreDataFailedDoneYieldarray' ignoreVal'$fFunctorParser$fFunctorParseResult