| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Mon, 19 Jan 2026 00:14:38 GMT
X-Served-By: cache-dfw-kdal2120049-DFW, cache-bom-vanm7210089-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768781678.695498,VS0,VE350
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
hw-json: Memory efficient JSON parser
hw-json: Memory efficient JSON parser
Modules
- HaskellWorks
- Data
- Json
- HaskellWorks.Data.Json.DecodeError
- HaskellWorks.Data.Json.FromValue
- Internal
- HaskellWorks.Data.Json.Internal.CharLike
- HaskellWorks.Data.Json.Internal.Doc
- HaskellWorks.Data.Json.Internal.Index
- HaskellWorks.Data.Json.Internal.PartialIndex
- HaskellWorks.Data.Json.Internal.Slurp
- Standard
- Cursor
- HaskellWorks.Data.Json.Internal.Standard.Cursor.Token
- Token
- HaskellWorks.Data.Json.Internal.Standard.Token.Tokenize
- Cursor
- HaskellWorks.Data.Json.Internal.Token
- HaskellWorks.Data.Json.Internal.Token.Types
- HaskellWorks.Data.Json.Internal.Value
- HaskellWorks.Data.Json.Internal.Word64
- HaskellWorks.Data.Json.LightJson
- HaskellWorks.Data.Json.PartialValue
- HaskellWorks.Data.Json.Query
- Simple
- HaskellWorks.Data.Json.Simple.Value
- Standard
- Load
- HaskellWorks.Data.Json.Standard.Load.Partial
- Load
- HaskellWorks.Data.Json.Value
- Json
- Data
Flags
Automatic Flags
| Name | Description | Default |
|---|---|---|
| bmi2 | Enable bmi2 instruction set | Disabled |
| sse42 | Enable sse4.2 instruction set | Disabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- hw-json-1.3.3.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
| Versions [RSS] | 0.0.0.1, 0.0.0.2, 0.0.0.3, 0.0.0.4, 0.1.0.0, 0.2.0.0, 0.2.0.1, 0.2.0.2, 0.2.0.3, 0.2.0.4, 0.3.0.0, 0.4.0.0, 0.5.0.0, 0.6.0.0, 0.7.0.1, 0.8.0.0, 0.8.1.0, 0.9.0.0, 0.9.0.1, 1.0.0.0, 1.0.0.1, 1.0.0.2, 1.1.0.0, 1.1.0.1, 1.1.0.2, 1.2.0.0, 1.2.0.1, 1.2.0.2, 1.3.0.0, 1.3.0.1, 1.3.1.0, 1.3.1.1, 1.3.2.0, 1.3.2.1, 1.3.2.2, 1.3.2.3, 1.3.2.4, 1.3.2.5, 1.3.3.0, 1.3.3.1 (info) |
|---|---|
| Dependencies | aeson (>=2.0 && <2.3), attoparsec (>=0.13 && <0.15), attoparsec-aeson (>=2 && <3), base (>=4.11 && <5), bits-extra (>=0.0.1.3 && <0.1), bytestring (>=0.10.6 && <0.13), dlist (>=0.8 && <1.1), generic-lens (>=1.2.0.1 && <2.3), hw-balancedparens (>=0.3.0.0 && <0.5), hw-bits (>=0.7.0.5 && <0.8), hw-json, hw-json-simd (>=0.1.0.2 && <0.2), hw-json-simple-cursor (>=0.1.0.1 && <0.2), hw-json-standard-cursor (>=0.2.0.1 && <0.3), hw-mquery (>=0.2.0.0 && <0.3), hw-parser (>=0.1 && <0.2), hw-prim (>=0.6.2.32 && <0.7), hw-rankselect (>=0.13 && <0.14), hw-rankselect-base (>=0.3.2.1 && <0.4), hw-simd (>=0.1.1.2 && <0.2), lens (>=4 && <6), mmap (>=0.5 && <0.6), optparse-applicative (>=0.14 && <0.19), prettyprinter (>=1 && <2), scientific (>=0.3.6.2 && <0.4), text (>=1.2 && <3), unordered-containers (>=0.2 && <0.3), vector (>=0.12 && <0.14), word8 (>=0.1 && <0.2) [details] |
| Tested with | ghc ==9.12.2, ghc ==9.10.2, ghc ==9.8.4, ghc ==9.6.7 |
| License | BSD-3-Clause |
| Copyright | 2016-2025 John Ky |
| Author | John Ky |
| Maintainer | newhoggy@gmail.com |
| Uploaded | by haskellworks at 2025-07-24T13:01:51Z |
| Category | Data |
| Home page | https://github.com/haskell-works/hw-json#readme |
| Bug tracker | https://github.com/haskell-works/hw-json/issues |
| Source repo | head: git clone https://github.com/haskell-works/hw-json |
| Distributions | |
| Reverse Dependencies | 5 direct, 2 indirect [details] |
| Executables | hw-json |
| Downloads | 22606 total (131 in the last 30 days) |
| Rating | 2.0 (votes: 1) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs not available [build log] All reported builds failed as of 2025-07-24 [all 2 reports] |
Readme for hw-json-1.3.3.1
[back to package description]hw-json
hw-json is a succinct JSON parsing library.
It uses succinct data-structures to allow traversal of large JSON strings with minimal memory overhead.
For an example, see app/Main.hs
Prerequisites
cabalversion2.2or later- Depending on your use case you may need additional package dependencies. These can be found in the library dependencies of the examples library component in the cabal file.
Memory benchmark
If you need a repl to run any of the Haskell examples in this README, please run the command:
cabal v2-repl lib:examples
For rexamples these examples are also found in Haskell modules under the examples directory.
Parsing large Json files in Scala with Argonaut
S0U EU OU MU CCSU CMD
--------- --------- ----------- -------- -------- ---------------------------------------------------------------
0.0 80,526.3 76,163.6 72,338.6 13,058.6 sbt console
0.0 536,660.4 76,163.6 72,338.6 13,058.6 import java.io._, argonaut._, Argonaut._
0.0 552,389.1 76,163.6 72,338.6 13,058.6 val file = new File("/Users/jky/Downloads/78mbs.json"
0.0 634,066.5 76,163.6 72,338.6 13,058.6 val array = new Array[Byte](file.length.asInstanceOf[Int])
0.0 644,552.3 76,163.6 72,338.6 13,058.6 val is = new FileInputStream("/Users/jky/Downloads/78mbs.json")
0.0 655,038.1 76,163.6 72,338.6 13,058.6 is.read(array)
294,976.0 160,159.7 1,100,365.0 79,310.8 13,748.1 val json = new String(array)
285,182.9 146,392.6 1,956,264.5 82,679.8 14,099.6 val data = Parse.parse(json)
***********
Parsing large Json files in Haskell with Aeson
-- CMD -- Mem (MB)
---------------------------------------------------------- -- --------
import Control.DeepSeq -- 345
import Data.Aeson -- 371
import qualified Data.ByteString.Lazy as LBS -- 376
!bs <- LBS.readFile "corpus/bench/hospitalisation.json" -- 380
let !y = decode bs :: Maybe Value -- 928
Parsing large Json files in Haskell with hw-json
-- CMD -- Mem (MB)
--------------------------------------------------------------------- -- --------
import qualified HaskellWorks.Data.ByteString as BS -- 351
import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as JCF -- 353
!jsonBs <- BS.mmap "corpus/bench/hospitalisation.json" -- 355
let !ibip = JCF.simdToIbBp jsonBs -- 358
let !c = JCF.fromBsIbBp jsonBs ibip -- 495
Examples
Navigation example
import Control.Monad
import qualified Data.ByteString as BS
import qualified HaskellWorks.Data.Json.Standard.Cursor.Fast as JCF
import qualified HaskellWorks.Data.TreeCursor as TC
let fc = TC.firstChild
let ns = TC.nextSibling
let pn = TC.parent
let ss = TC.subtreeSize
let jsonBs = "[null, {\"field\": 1}]" :: BS.ByteString
let ibip = JCF.simdToIbBp jsonBs
let cursor = JCF.fromBsIbBp jsonBs ibip
fc cursor
(fc >=> ns) cursor
Querying example
import Control.Monad
import Data.Function
import Data.List
import HaskellWorks.Data.Json.PartialValue
import HaskellWorks.Data.Json.Standard.Cursor.Load.Cursor
import HaskellWorks.Data.Json.Standard.Load.Partial
import HaskellWorks.Data.MQuery
import HaskellWorks.Data.MQuery.Micro
import qualified Data.DList as DL
!cursor <- loadPartial "corpus/bench/78mb.json"
!cursor <- loadCursorWithIndex "corpus/bench/78mb.json"
!cursor <- loadCursor "corpus/bench/78mb.json"
!cursor <- loadCursorWithCsPoppyIndex "corpus/bench/78mb.json"
let !json = jsonPartialJsonValueAt cursor
let q = MQuery (DL.singleton json)
putPretty $ q >>= item & limit 10
putPretty $ q >>= item & page 10 1
putPretty $ q >>= item >>= hasKV "founded_year" (JsonPartialNumber 2005) & limit 10
putPretty $ q >>= item >>= entry
putPretty $ q >>= item >>= entry >>= named "name" & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> entry >=> named "price_currency_code")
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> entry >=> named "price_currency_code") & onList (uniq . sort)
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> having (entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") >=> entry >=> named "price_amount") & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> having (entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") >=> entry >=> named "price_amount" >=> castAsInteger ) & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> having (entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") >=> entry >=> named "price_amount" >=> castAsInteger ) & aggregate sum
putPretty $ q >>= item & limit 10
putPretty $ q >>= item & page 10 1
putPretty $ q >>= item >>= entry
putPretty $ q >>= item >>= entry >>= named "name" & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> entry >=> named "price_currency_code" >=> asString)
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> entry >=> named "price_currency_code" >=> asString) & onList (uniq . sort)
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> having (entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") >=> entry >=> named "price_amount") & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> having (entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") >=> entry >=> named "price_amount" >=> castAsInteger ) & limit 10
putPretty $ q >>= (item >=> entry >=> named "acquisition" >=> having (entry >=> named "price_currency_code" >=> asString >=> valueOf "USD") >=> entry >=> named "price_amount" >=> castAsInteger ) & aggregate sum
References
- Semi-Indexing Semi-Structured Data in Tiny Space
- Succinct Data Structures talk by Edward Kmett
- Typed Tagless Final Interpreters