{"id":17695876,"url":"https://github.com/nadako/hijson","last_synced_at":"2026-01-21T16:32:08.471Z","repository":{"id":145325926,"uuid":"195123219","full_name":"nadako/hijson","owner":"nadako","description":"Inverted JSON parser for Haxe","archived":false,"fork":false,"pushed_at":"2019-07-09T14:48:43.000Z","size":171,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T11:53:41.314Z","etag":null,"topics":["haxe","haxe-library","json","json-parser"],"latest_commit_sha":null,"homepage":"","language":"Haxe","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nadako.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-03T20:37:04.000Z","updated_at":"2024-10-23T15:24:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d00b6a2-81c9-4b80-8761-b7879e91d058","html_url":"https://github.com/nadako/hijson","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhijson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhijson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhijson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nadako%2Fhijson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nadako","download_url":"https://codeload.github.com/nadako/hijson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247615482,"owners_count":20967182,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haxe","haxe-library","json","json-parser"],"created_at":"2024-10-24T14:07:16.717Z","updated_at":"2026-01-21T16:32:03.448Z","avatar_url":"https://github.com/nadako.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hijson: Inverted JSON parser for Haxe\n\n[![Build Status](https://travis-ci.org/nadako/hijson.svg?branch=master)](https://travis-ci.org/nadako/hijson)\n\nThis is a variantion of `haxe.format.JsonParser` that gives the user full control over creation of parsed values.\n\n**STATUS**: work in progress, subject to random changes, more docs to come\n\nRequired Haxe version: 4.0.0-rc.3 and later\n\nAPI reference: https://nadako.github.io/hijson/\n\n## About\n\nThe main idea of this library is that parsing the JSON data can be separated from building values\nfrom it. So we introduce the concept of `Consumer` that consumes raw JSON values and produces some\nvalue out of it. The `Parser` is then supplied with a `Consumer` instance and calls its method so\nit can actually return values from the parser JSON data.\n\nThis way we _invert_ the control over JSON parsing, allowing user to plug in custom JSON processing logic\nin a simple and efficient way.\n\n## Usage\n\nThe parsing API could not be simplier:\n\n```haxe\nvar value = hijson.Parser.parse('{\"name\": \"Dan\"}', myConsumer);\n```\n\nThe most interesting here part is that `myConsumer` which is an instance of the [`Consumer`](https://nadako.github.io/hijson/hijson/Consumer.html)\ninterface that defines how the JSON is supposed to be parsed. The implementation must provide these methods:\n\n```haxe\nfunction consumeString(s:String):TResult;\nfunction consumeNumber(n:String):TResult;\nfunction consumeBool(b:Bool):TResult;\nfunction consumeNull():TResult;\nfunction consumeArray():TArrayContext;\nfunction addArrayElement(context:TArrayContext, parser:Parser):Void;\nfunction finalizeArray(context:TArrayContext):TResult;\nfunction consumeObject():TObjectContext;\nfunction addObjectField(context:TObjectContext, name:String, parser:Parser):Void;\nfunction finalizeObject(context:TObjectContext):TResult;\n```\n\nThese are the methods that are called by the `Parser` for producing values out of raw JSON data.\n\nOf course, most of the real-world consumers would only work with a single JSON value kind,\nso we have a handy [`BaseConsumer`](https://nadako.github.io/hijson/hijson/BaseConsumer.html) implementation\nthat implements the `Consumer` interface by throwing \"unexpected value\" errors in every method, which we can\nthen subclass and override the methods we're interested in.\n\nWe also provide a set of standard consumers for common Haxe types, like String, Int, Bool, Array, Map and so on. See the [API reference](https://nadako.github.io/hijson/) for details.\n\n### Automagic consumers for custom types\n\n**NOT IMPLEMENTED YET, see [#4](https://github.com/nadako/hijson/issues/4)**\n\nOf course, writing `Consumer` implementations for custom data types, such as classes, enums and anonymous structures,\nwould be too annoying. So the plan is to implement a macro-based `Consumer` builder for these kinds of data types.\n\n## Differences to other libraries:\n\n * `haxe.Json`/`haxe.format.JsonParser`\n * `hxjson`\n * `json2object`\n * `tink_json`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadako%2Fhijson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnadako%2Fhijson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnadako%2Fhijson/lists"}